Package manifold.rt.api.util
Class AbstractIterator<T>
java.lang.Object
manifold.rt.api.util.AbstractIterator<T>
- All Implemented Interfaces:
Iterator<T>
A base class to simplify implementing iterators so that implementations only have to implement [computeNext]
to implement the iterator, calling [done] when the iteration is complete.
-
Constructor Details
-
AbstractIterator
public AbstractIterator()
-
-
Method Details
-
computeNext
protected abstract void computeNext()Computes the next item in the iterator.This callback method should call one of these two methods:
* [setNext] with the next value of the iteration * [done] to indicate there are no more elements
Failure to call either method will result in the iteration terminating with a failed state
-
hasNext
public boolean hasNext() -
next
-
setNext
Sets the next value in the iteration, called from the [computeNext] function -
done
protected void done()Sets the state to done so that the iteration terminates.
-