public abstract class AbstractSequentialIterator<T> extends UnmodifiableIterator<T>
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSequentialIterator(T firstOrNull)
Creates a new iterator with the given first element, or, if
firstOrNull is null, creates a new empty iterator. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
computeNext(T previous)
Returns the element that follows
previous, or returns null
if no elements remain. |
boolean |
hasNext() |
T |
next() |
removeprotected AbstractSequentialIterator(T firstOrNull)
firstOrNull is null, creates a new empty iterator.@Nullable protected abstract T computeNext(T previous)
previous, or returns null
if no elements remain. This method is invoked during each call to
next() in order to compute the result of a future call to
next().public final boolean hasNext()
@Nullable public final T next()