I - the type of elements to iterate overprivate abstract class HashMap.MapIterator<I>
extends java.lang.Object
implements java.util.Iterator<I>, java.lang.Iterable<I>
| Modifier and Type | Field and Description |
|---|---|
private HashMap.Entry<K,V> |
current
Stores the current element in bucket chain.
|
private int |
currentPos
Stores the current position relative to
AbstractLongHashMap.map. |
private HashMap.Entry<K,V> |
next
Stores the next element in bucket chain.
|
private int |
pos
Stores the next position relative to
AbstractLongHashMap.map. |
private HashMap.Entry<K,V> |
prev
Stores the previous element in bucket chain.
|
| Constructor and Description |
|---|
MapIterator()
Initializes the iterator and places it to the first element.
|
| Modifier and Type | Method and Description |
|---|---|
protected HashMap.Entry<K,V> |
findNext(boolean throwException)
Searches for the next element in the
map element chains and returns the current element (
next
before call). |
boolean |
hasNext()
Returns whether there is a next element.
|
java.util.Iterator<I> |
iterator()
Returns an iterator over a set of elements of type T.
|
void |
remove() |
private int currentPos
AbstractLongHashMap.map.private int pos
AbstractLongHashMap.map.private HashMap.Entry<K,V> next
private HashMap.Entry<K,V> current
private HashMap.Entry<K,V> prev
public MapIterator()
public java.util.Iterator<I> iterator()
iterator in interface java.lang.Iterable<I>public boolean hasNext()
hasNext in interface java.util.Iterator<I>true if there is a next element,
false elseprotected HashMap.Entry<K,V> findNext(boolean throwException)
next
before call). This method modifies next as a side effect.throwException - whether this method should throw an exception
if there is no next elementthrowException is falsejava.util.NoSuchElementException - in case that
throwException is true and there is no
next elementpublic void remove()
remove in interface java.util.Iterator<I>