Package eu.bandm.tools.util
Class LookaheadIterator<T>
java.lang.Object
eu.bandm.tools.util.LookaheadIterator<T>
- All Implemented Interfaces:
Iterator<T>
An iterator which allows arbitrary deep look-ahead for an underlying iterator.
-
Constructor Summary
ConstructorDescriptionLookaheadIterator
(Iterable<? extends T> things) Constructor which sets the underlying iterator.LookaheadIterator
(Iterator<? extends T> it) LookaheadIterator
(T... things) Constructor which iterates over the given things. -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
boolean
hasNext
(int index) Returns whether the next (index+1) calls tohasNext()
will be successful.lookahead
(int index) Returns the object delivered by the last of (index+1) calls ofnext()
, as defined with the original iterator.next()
void
remove()
Unsupported OperationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
LookaheadIterator
Constructor which sets the underlying iterator. -
LookaheadIterator
Constructor which iterates over the given things. -
LookaheadIterator
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove()Unsupported Operation -
hasNext
public boolean hasNext(int index) Returns whether the next (index+1) calls tohasNext()
will be successful. -
lookahead
Returns the object delivered by the last of (index+1) calls ofnext()
, as defined with the original iterator.
-