|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--structure.AbstractIterator | +--structure.KeyIterator
A private master iterator for filtering the key fields from
an Association-returning iterator. This iterator returns
objects of the Comparable
type, and is
publically available throught the Hashtable.keys()
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 | |
KeyIterator(java.util.Iterator slave)
Construct a new key iterator that filters the slave iterator, an Association-returning iterator. |
Method Summary | |
java.lang.Object |
get()
Returns the current key from the slave iterator. |
boolean |
hasNext()
Returns true if an association is available for generating a key. |
java.lang.Object |
next()
Returns the current key, and increments the iterator. |
void |
reset()
Resets the slave iterator (and thus the key 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 |
protected java.util.Iterator slave
Constructor Detail |
public KeyIterator(java.util.Iterator slave)
slave
- The slave iterator.Method Detail |
public void reset()
reset
in class AbstractIterator
public boolean hasNext()
hasNext
in interface java.util.Iterator
hasNext
in class AbstractIterator
AbstractIterator.hasMoreElements()
public java.lang.Object next()
next
in interface java.util.Iterator
next
in class AbstractIterator
AbstractIterator.hasMoreElements()
,
AbstractIterator.value()
public java.lang.Object get()
get
in class AbstractIterator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |