Latest web development tutorials

Java Data Structure

Java toolkit provides a powerful data structure. In Java, the data structure includes the following interfaces and classes:

  • Enumeration (Enumeration)
  • Bit set (BitSet)
  • Vector (Vector)
  • Stack (Stack)
  • Dictionary (Dictionary)
  • Hash table (Hashtable)
  • Properties (Properties)

These classes are the traditional left, introduces a new framework for Java2 - the Collections Framework (Collection), we'll discuss later.


Enumeration (Enumeration)

Enumeration (Enumeration) although the interface itself is not part of the data structure, but its application in the context of other data structures in very broad. Enumeration (The Enumeration) interface defines a data structure retrieved from successive elements of the way.

For example, a call nextElement enumeration defines the method used to get the next element comprising a multi-element data structure.

For more information about the enumeration interface, see the enumeration (the Enumeration) .


Bit set (BitSet)

Bit collection classes implement a set can be individually set and clear bits or flags.

This class is very useful in dealing with a set of Boolean values, you just have to give each value is assigned a "bit", and then make the appropriate bit is set or cleared, you can operate a Boolean value.

For more information about this class, see the bits set (BitSet) .


Vector (Vector)

Vector (Vector) class and traditional arrays are very similar, but the size of a Vector can change dynamically as needed.

Like arrays, elements Vector objects are accessed through the index.

The main advantage of using the Vector class that is created when the object is not necessary to specify the size of the object, its size will change dynamically based on need.

For more information about this class, see the vector (Vector)


Stack (Stack)

Stack (Stack) implements a last in first out (LIFO) data structure.

You can stack understood as objects stack vertical distribution when you add a new element, a new element will be placed on top of the other elements.

When you take an element from the stack when he took an element from the stack. In other words, the last element into the stack of the first to be removed.

For more information about this class, see the stack (Stack) .


Dictionary (Dictionary)

Dictionary (Dictionary) class is an abstract class that defines the data structure that maps keys to values.

When you want to access the data through a specific key instead of an integer index, when it should be used when Dictionary.

Since the Dictionary class is abstract, so it only provides a data structure that maps keys to values, but does not provide specific implementation.

For more information about this class, see the dictionary (the Dictionary) .


Hash table (Hashtable)

Hashtable class provides a means on the basis of user-defined key structure up organizational data.

For example, in the hash table address list, you can zip code as the key to store and sort the data, rather than names.

Specific meaning depends entirely on the key hash table hash table use scenarios and the data it contains.

For more information about this class, see the hash table (the HashTable) .


Properties (Properties)

Properties inherited from Hashtable.Properties class represents a persistent set of properties. Each key and its corresponding value in the property list is a string.

Properties class used by many Java classes. For example, when it returns the value of the environment variables as System.getProperties () method.

For more information about this class, see Properties (the Properties) .