java.util
Class Hashtable.ValueEnumerator

java.lang.Object
java.util.Hashtable.EntryEnumerator
java.util.Hashtable.ValueEnumerator
- All Implemented Interfaces:
- Enumeration
- Enclosing class:
- Hashtable
- private final class Hashtable.ValueEnumerator
- extends Hashtable.EntryEnumerator
Enumeration view of this Hashtable, providing sequential access to its
values.
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.ValueEnumerator
private Hashtable.ValueEnumerator()
nextElement
public java.lang.Object nextElement()
- Returns the next element.
- Specified by:
nextElement in interface Enumeration- Overrides:
nextElement in class Hashtable.EntryEnumerator
hasMoreElements
public boolean hasMoreElements()
- Checks whether more elements remain in the enumeration.
- Specified by:
hasMoreElements in interface Enumeration