Package com.google.common.collect
Interface PeekingIterator<E>
-
- All Superinterfaces:
java.util.Iterator<E>
@GwtCompatible public interface PeekingIterator<E> extends java.util.Iterator<E>
An iterator that supports a one-element lookahead while iterating.See the Guava User Guide article on
PeekingIterator
.- Since:
- 2.0 (imported from Google Collections Library)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description E
next()
E
peek()
Returns the next element in the iteration, without advancing the iteration.void
remove()
-
-
-
Method Detail
-
peek
E 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:
java.util.NoSuchElementException
- if the iteration has no more elements according toIterator.hasNext()
-
next
E next()
The objects returned by consecutive calls to
peek()
thennext()
are guaranteed to be equal to each other.- Specified by:
next
in interfacejava.util.Iterator<E>
-
remove
void remove()
-
-