|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--structure.AbstractIterator
|
+--structure.HashtableIterator
A traversal of all the elements as they appear in a hashtable.
No order is guaranteed. This iterator is not publically accessable
and is used to implement Hashtable's key and value iterators.
This iteration returns objects that are instances of Association.
Typical use:
Hashtable h = new Hashtable();
// ...hashtable gets built up...
Iterator hi = new HashtableIterator(h.data);
while (hi.hasNext())
{
System.out.println(ai.next());
}
| Field Summary | |
protected int |
current
The current entry being considered. |
protected Association[] |
data
Reference to hash table data |
| Constructor Summary | |
HashtableIterator(Association[] table)
Construct a traversal over a hashtable. |
|
| Method Summary | |
java.lang.Object |
get()
Get current value of traversal. |
boolean |
hasNext()
Returns true iff there are unconsidered elements within the table. |
java.lang.Object |
next()
Returns current value and increments traversal. |
void |
reset()
Resets the traversal to point to the beginning of the 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 |
protected int current
protected Association[] data
| Constructor Detail |
public HashtableIterator(Association[] table)
table - The array of lists to be traversed.| Method Detail |
public void reset()
reset in class AbstractIteratorpublic boolean hasNext()
hasNext in interface java.util.IteratorhasNext in class AbstractIteratorAbstractIterator.hasMoreElements()public java.lang.Object next()
next in interface java.util.Iteratornext in class AbstractIteratorAbstractIterator.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 | ||||||||