public interface LookaheadIterator<E>
Modifier and Type | Method and Description |
---|---|
E |
element()
Returns the next element in iteration without advancing the underlying iterator.
|
E |
peek()
Returns the next element in iteration without advancing the underlying iterator.
|
E peek()
Note: this method does not throw a NoSuchElementException
if the iterator
is already exhausted. If you want such a behavior, use element()
instead.
The rationale behind this is to follow the Queue
interface
which uses the same terminology.
E element()
NoSuchElementException
- if the iterator is already exhausted according to #hasNext()
Copyright © 2007–2024. All rights reserved.