protected class ConcurrentReaderHashMap.HashIterator
extends Object
implements Iterator, Enumeration
Walks a snapshot of the bins from last to first. next() returns the current entry unless a subclass overrides returnValueOfNext(). One thread should own an instance. A concurrent removal may be skipped, and the iterator does not throw ConcurrentModificationException.
| Modifiers | Name | Description |
|---|---|---|
protected Object |
currentKey |
Key of the entry hasNext() has already accepted. |
protected Object |
currentValue |
Value of the entry hasNext() has already accepted. |
protected ConcurrentReaderHashMap.Entry |
entry |
Entry currently under consideration, or null when the next step must move to another bin. |
protected int |
index |
Next bin index to read. |
protected ConcurrentReaderHashMap.Entry |
lastReturned |
Entry most recently returned by next(). |
protected ConcurrentReaderHashMap.Entry[] |
tab |
Bins captured when this iterator was constructed. |
| Constructor and description |
|---|
protected HashIterator()Constructs a new HashIterator over a snapshot of the table. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public boolean |
hasMoreElements()Returns whether there are more elements (Enumeration interface). |
|
public boolean |
hasNext()Returns whether there are more elements to iterate over. |
|
public Object |
next()Returns the next element in the iteration. |
|
public Object |
nextElement()Returns the next element (Enumeration interface). |
|
public void |
remove()Removes the last returned element from the map. |
|
protected Object |
returnValueOfNext()Returns the value of the next element. |
Key of the entry hasNext() has already accepted. Null when no element is ready for next().
Value of the entry hasNext() has already accepted. Null when no element is ready for next().
Entry currently under consideration, or null when the next step must move to another bin.
Next bin index to read. Counts down from the last bin.
Entry most recently returned by next(). Null before the first successful call and again after remove().
Bins captured when this iterator was constructed.
Constructs a new HashIterator over a snapshot of the table.
Returns whether there are more elements (Enumeration interface).
Returns whether there are more elements to iterate over.
Returns the next element in the iteration.
Returns the next element (Enumeration interface).
Removes the last returned element from the map.
Returns the value of the next element. This method can be overridden by subclasses to return different values (e.g., just the key or just the value instead of the whole entry).
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.