structure
Class ValueIterator

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

class ValueIterator
extends AbstractIterator

A private master iterator for filtering the value fields from an Association-returning iterator.This iterator returns objects of the Object type, and is publically available throught the Hashtable.iterator() method.

Typical use:

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


Field Summary
protected  java.util.Iterator slave
          The underlying iterator.
 
Constructor Summary
ValueIterator(java.util.Iterator slave)
          Construct a new value iterator that filters the slave iterator, an Association-returning iterator.
 
Method Summary
 java.lang.Object get()
          Returns the current value from the slave iterator.
 boolean hasNext()
          Returns true if an association is available for generating a value.
 java.lang.Object next()
          Returns the current value, and increments the iterator.
 void reset()
          Resets the slave iterator (and thus the value iterator) to the first association in the structure.
 
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

slave

protected java.util.Iterator slave
The underlying iterator. The slave iterator provides the value iterator values which are Associations. The value iterator returns only the value-portion of the Associations.

Constructor Detail

ValueIterator

public ValueIterator(java.util.Iterator slave)
Construct a new value iterator that filters the slave iterator, an Association-returning iterator.

Parameters:
slave - The slave iterator.
Method Detail

reset

public void reset()
Resets the slave iterator (and thus the value iterator) to the first association in the structure.

Specified by:
reset in class AbstractIterator

hasNext

public boolean hasNext()
Returns true if an association is available for generating a value.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in class AbstractIterator
Returns:
True if a valid value can be generated.
See Also:
AbstractIterator.hasMoreElements()

next

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

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

get

public java.lang.Object get()
Returns the current value from the slave iterator.

Specified by:
get in class AbstractIterator
Returns:
The current value associated with the iterator.