Package eu.bandm.tools.util.java
Interface Iterators.MultipleLookaheadIterator<E>
- Type Parameters:
E
- the element type
- All Superinterfaces:
Iterator<E>
- Enclosing class:
Iterators
Iterators which allow arbitrary deep look-ahead.
-
Method Summary
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
hasNext
boolean hasNext(int k) Checks whether there arek+1
more elements.hasNext(0)
is equivalent tohasNext()
.- Parameters:
k
- a nonnegative number- Returns:
true
ifnext
may be calledk+1
times- Throws:
IllegalArgumentException
- ifk
is negative- See Also:
-
lookahead
Returns the element that comes afterk
skipped elements, without changing the state of the iterator.lookahead(0)
returns the element that would also be returned bynext
.- Parameters:
k
- a nonnegative number- Returns:
- the
k+1
-th element - Throws:
NoSuchElementException
- if there are not enough remaining elements
-