java.util
Class Hashtable.EntryEnumerator

java.lang.Object
java.util.Hashtable.EntryEnumerator
- All Implemented Interfaces:
- Enumeration
- Direct Known Subclasses:
- Hashtable.KeyEnumerator, Hashtable.ValueEnumerator
- Enclosing class:
- Hashtable
- private class Hashtable.EntryEnumerator
- extends java.lang.Object
- implements Enumeration
Enumeration view of the entries in this Hashtable, providing
sequential access to its elements.
NOTE: Enumeration is not safe if new elements are put in the table
as this could cause a rehash and we'd completely lose our place. Even
without a rehash, it is undetermined if a new element added would
appear in the enumeration. The spec says nothing about this, but
the "Java Class Libraries" book implies that modifications to the
hashtable during enumeration causes indeterminate results. Don't do it!
|
Field Summary |
(package private) int |
count
The number of elements remaining to be returned by next(). |
(package private) int |
idx
Current index in the physical hash table. |
(package private) Hashtable.HashEntry |
next
Entry which will be returned by the next nextElement() call. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
count
int count
- The number of elements remaining to be returned by next().
idx
int idx
- Current index in the physical hash table.
next
Hashtable.HashEntry next
- Entry which will be returned by the next nextElement() call. It is
set if we are iterating through a bucket with multiple entries, or null
if we must look in the next bucket.
Hashtable.EntryEnumerator
Hashtable.EntryEnumerator()
- Construct the enumeration.
hasMoreElements
public boolean hasMoreElements()
- Checks whether more elements remain in the enumeration.
- Specified by:
hasMoreElements in interface Enumeration
nextElement
public java.lang.Object nextElement()
- Returns the next element.
- Specified by:
nextElement in interface Enumeration