E
- Der ELement-Typpublic interface Peekerator<E> extends Iterator<E>
Iterator
with the capability to "peek" an element.peek()
Modifier and Type | Method and Description |
---|---|
E |
next()
Consumes and returns the next element in this iteration.
|
E |
peek()
Just like
next() , but does not consume the next element. |
void |
remove()
|
forEachRemaining, hasNext
E next()
next
in interface Iterator<E>
NoSuchElementException
- This iteration has no more elementsE peek()
next()
, but does not consume the next element.
I.e. the next invocation of peek()
of next()
will return the same element that this
invocation returns.NoSuchElementException
- This iteration has no more elementsvoid remove()
remove
in interface Iterator<E>
UnsupportedOperationException
- This operation is not supported by this peekerator, probably because
this peekerator is not backed by a collectionIllegalStateException
- The next()
or peek()
methods have not yet been calledIllegalStateException
- The remove()
method has already been called after the last call
to next()
or peek()
Copyright © 2018 Arno Unkrig. All rights reserved.