|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PeekingIterator<E>
An iterator that supports a one-element lookahead while iterating.
Method Summary | |
---|---|
E |
peek()
Returns the next element in the iteration without advancing the iteration. |
Methods inherited from interface java.util.Iterator |
---|
hasNext, next, remove |
Method Detail |
---|
E peek()
If possible, calls to peek()
should not affect the iteration.
As is the case with most Iterators, modifications to the underlying
iteration may have unanticipated results.
If there are no remaining elements in the iteration, peek()
will throw a NoSuchElementException
. (A null
return value
does not indicate that this iterator has reached the end of its
iteration.)
Usage note: Implementations may, but are not required to,
support remove()
following a call to peek()
.
NoSuchElementException
- if the iteration has
no more elements.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |