Package org.apache.lucene.internal.hppc
Class AbstractIterator<E>
- java.lang.Object
-
- org.apache.lucene.internal.hppc.AbstractIterator<E>
-
- All Implemented Interfaces:
Iterator<E>
- Direct Known Subclasses:
CharHashSet.EntryIterator
,IntHashSet.EntryIterator
,LongHashSet.EntryIterator
public abstract class AbstractIterator<E> extends Object implements Iterator<E>
Simplifies the implementation of iterators a bit. Modeled loosely after Google Guava's API.Forked from com.carrotsearch.hppc.AbstractIterator
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
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
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Method Detail
-
remove
public void remove()
Default implementation throwsUnsupportedOperationException
.
-
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.
-
-