T - the type of elements returned by this iteratorpublic final class PeekingReiterator<T> extends Object implements Reiterator<T>
Reiterator that supports one-element lookahead during iteration.| Constructor and Description |
|---|
PeekingReiterator(Reiterator<T> iterator) |
| Modifier and Type | Method and Description |
|---|---|
PeekingReiterator<T> |
copy()
Returns a copy of the current
Reiterator. |
boolean |
hasNext() |
T |
next() |
T |
peek()
Returns the element that would be returned by
next(), without
actually consuming the element. |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic PeekingReiterator(Reiterator<T> iterator)
public PeekingReiterator<T> copy()
ReiteratorReiterator. The copy's iteration
state is logically independent of the current iterator; each may be
advanced without affecting the other.
The returned Reiterator is not guaranteed to return
referentially identical iteration results as the original
Reiterator, although Object.equals(java.lang.Object) will typically return
true for the corresponding elements of each if the original source is
logically immutable.
copy in interface Reiterator<T>public T peek()
next(), without
actually consuming the element.NoSuchElementException - if there is no next element