Package org.apache.lucene.util.hppc
Class IntIntHashMap.AbstractIterator<E>
- java.lang.Object
-
- org.apache.lucene.util.hppc.IntIntHashMap.AbstractIterator<E>
-
- All Implemented Interfaces:
java.util.Iterator<E>
- Direct Known Subclasses:
IntIntHashMap.EntryIterator
,IntIntHashMap.KeysIterator
,IntIntHashMap.ValuesIterator
- Enclosing class:
- IntIntHashMap
public abstract static class IntIntHashMap.AbstractIterator<E> extends java.lang.Object implements java.util.Iterator<E>
Simplifies the implementation of iterators a bit. Modeled loosely after Google Guava's API.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
AT_END
private static int
CACHED
private E
nextElement
The next element to be returned fromnext()
if fetched.private static int
NOT_CACHED
private int
state
Current iterator state.
-
Constructor Summary
Constructors Constructor Description AbstractIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected E
done()
Call when done.protected abstract E
fetch()
Fetch next element.boolean
hasNext()
E
next()
void
remove()
Default implementation throwsUnsupportedOperationException
.
-
-
-
Field Detail
-
NOT_CACHED
private static final int NOT_CACHED
- See Also:
- Constant Field Values
-
CACHED
private static final int CACHED
- See Also:
- Constant Field Values
-
AT_END
private static final int AT_END
- See Also:
- Constant Field Values
-
state
private int state
Current iterator state.
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<E>
-
remove
public void remove()
Default implementation throwsUnsupportedOperationException
.- Specified by:
remove
in interfacejava.util.Iterator<E>
-
fetch
protected abstract E fetch()
Fetch next element. The implementation must returndone()
when all elements have been fetched.- Returns:
- Returns the next value for the iterator or chain-calls
done()
.
-
done
protected final E done()
Call when done.- Returns:
- Returns a unique sentinel value to indicate end-of-iteration.
-
-