23.11.2017 Views

java_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

28. Java – Data Structures<br />

Java<br />

The data structures provided by the Java utility package are very powerful and perform a<br />

wide range of functions. These data structures consist of the following interface and<br />

classes:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Enumeration<br />

BitSet<br />

Vector<br />

Stack<br />

Dictionary<br />

Hashtable<br />

Properties<br />

All these classes are now legacy and Java-2 has introduced a new framework called<br />

Collections Framework, which is discussed in the next chapter.<br />

The Enumeration<br />

The Enumeration interface isn't itself a data structure, but it is very important within the<br />

context of other data structures. The Enumeration interface defines a means to retrieve<br />

successive elements from a data structure.<br />

For example, Enumeration defines a method called nextElement that is used to get the<br />

next element in a data structure that contains multiple elements.<br />

To have more detail about this interface, check The Enumeration.<br />

The Enumeration Interface<br />

The Enumeration interface defines the methods by which you can enumerate (obtain one<br />

at a time) the elements in a collection of objects.<br />

This legacy interface has been superceded by Iterator. Although not deprecated,<br />

Enumeration is considered obsolete for new code. However, it is used by several methods<br />

defined by the legacy classes such as Vector and Properties, is used by several other API<br />

classes, and is currently in widespread use in application code.<br />

341

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!