Package generic.util
Interface PeekableIterator<T>
- Type Parameters:
T
- The type of this iterator.
- All Superinterfaces:
Iterator<T>
- All Known Implementing Classes:
WrappingPeekableIterator
An iterator that allows you to peek at the next item on the iterator.
-
Method Summary
Modifier and TypeMethodDescriptionpeek()
Returns the item that would be returned by callingIterator.next()
, but does not increment the iterator asnext
would.Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
peek
Returns the item that would be returned by callingIterator.next()
, but does not increment the iterator asnext
would.- Returns:
- the item that would be returned by calling
Iterator.next()
- Throws:
NoSuchElementException
-