Class LazyIterator<T>
java.lang.Object
com.googlecode.concurrenttrees.common.LazyIterator<T>
- All Implemented Interfaces:
Iterator<T>
An unmodifiable iterator which computes the next element to return only when it is requested.
This class is inspired by com.google.common.collect.AbstractIterator in Google Guava,
which was written by the Google Guava Authors, in particular by Kevin Bourrillion.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
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
-
Field Details
-
next
T next -
state
LazyIterator.State state
-
-
Constructor Details
-
LazyIterator
public LazyIterator()
-
-
Method Details
-
remove
public void remove() -
hasNext
public final boolean hasNext() -
tryToComputeNext
boolean tryToComputeNext() -
next
-
endOfData
- Returns:
- a dummy value which if returned by the
computeNext()
method, signals that there are no more elements to return
-
computeNext
- Returns:
- The next element which the iterator should return, or the result of calling
endOfData()
if there are no more elements to return
-