|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@GwtCompatible public interface PeekingIterator<E>
An iterator that supports a one-element lookahead while iterating.
Method Summary | |
---|---|
E |
next()
|
E |
peek()
Returns the next element in the iteration, without advancing the iteration. |
void |
remove()
|
Methods inherited from interface java.util.Iterator |
---|
hasNext |
Method Detail |
---|
E peek()
Calls to peek()
should not change the state of the iteration,
except that it may prevent removal of the most recent element via
remove()
.
NoSuchElementException
- if the iteration has no more elements
according to Iterator.hasNext()
E next()
The objects returned by consecutive calls to peek()
then next()
are guaranteed to be equal to each other.
next
in interface Iterator<E>
void remove()
Implementations may or may not support removal when a call to peek()
has occurred since the most recent call to next()
.
remove
in interface Iterator<E>
IllegalStateException
- if there has been a call to peek()
since the most recent call to next()
and this implementation
does not support this sequence of calls (optional)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |