- All Superinterfaces:
- Iterator<E>
@DoNotMock("Use Iterators.peekingIterator")
@GwtCompatible
public interface PeekingIterator<E extends @Nullable Object>
extends Iterator<E>
An iterator that supports a one-element lookahead while iterating.
 
See the Guava User Guide article on 
 PeekingIterator.
- Since:
- 2.0
- Author:
- Mick Killianey
- 
Method SummaryMethods inherited from interface java.util.IteratorforEachRemaining, hasNext
- 
Method Details- 
peekE peek()Returns the next element in the iteration, without advancing the iteration.Calls to peek()should not change the state of the iteration, except that it may prevent removal of the most recent element viaremove().- Throws:
- NoSuchElementException- if the iteration has no more elements according to- Iterator.hasNext()
 
- 
next
- 
remove
 
-