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 intAT_ENDprivate static intCACHEDprivate EnextElementThe next element to be returned fromnext()if fetched.private static intNOT_CACHEDprivate intstateCurrent iterator state.
-
Constructor Summary
Constructors Constructor Description AbstractIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Edone()Call when done.protected abstract Efetch()Fetch next element.booleanhasNext()Enext()voidremove()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:
hasNextin interfacejava.util.Iterator<E>
-
remove
public void remove()
Default implementation throwsUnsupportedOperationException.- Specified by:
removein 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.
-
-