structure
Class ChainedHashtableIterator

java.lang.Object
  |
  +--structure.AbstractIterator
        |
        +--structure.ChainedHashtableIterator
All Implemented Interfaces:
java.util.Enumeration, java.util.Iterator

class ChainedHashtableIterator
extends AbstractIterator

A traversal of all the elements as they appear in a chained hashtable. No order is guaranteed. This iterator is not publically accessable and is used to implement ChainedHashtable's key and value iterators. This iteration returns objects that are instances of Association.

Typical use:

      ChainedHashtable h = new ChainedHashtable();
      // ...hashtable gets built up...
      Iterator hi = new ChainedHashtableIterator(h.data);
      while (hi.hasNext())
      {
          System.out.println(ai.next());
      }
 


Field Summary
protected  List data
          The list of values within the table.
protected  java.util.Iterator elements
          The iterator over the elements of the list.
 
Constructor Summary
ChainedHashtableIterator(List[] table)
          Construct an iterator over a chained hashtable.
 
Method Summary
 java.lang.Object get()
          Get current value of iterator.
 boolean hasNext()
          Returns true iff there are unconsidered elements within the table.
 java.lang.Object next()
          Returns current value and increments iterator.
 void reset()
          Resets the iterator to point to the beginning of the chained table.
 
Methods inherited from class structure.AbstractIterator
hasMoreElements, nextElement, remove, value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected List data
The list of values within the table.


elements

protected java.util.Iterator elements
The iterator over the elements of the list.

Constructor Detail

ChainedHashtableIterator

public ChainedHashtableIterator(List[] table)
Construct an iterator over a chained hashtable.

Parameters:
table - The array of lists to be traversed.
Method Detail

reset

public void reset()
Resets the iterator to point to the beginning of the chained table.

Specified by:
reset in class AbstractIterator

hasNext

public boolean hasNext()
Returns true iff there are unconsidered elements within the table.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in class AbstractIterator
Returns:
True iff there are elements yet to be considered within table.
See Also:
AbstractIterator.hasMoreElements()

next

public java.lang.Object next()
Returns current value and increments iterator.

Specified by:
next in interface java.util.Iterator
Specified by:
next in class AbstractIterator
Returns:
The current value, before incrementing.
See Also:
AbstractIterator.hasMoreElements(), AbstractIterator.value()

get

public java.lang.Object get()
Get current value of iterator.

Specified by:
get in class AbstractIterator
Returns:
The current value.