public class FunctionIterator<T,V> extends Object implements CloseableIterator<V>
Iterator
implementation to convert each item from the target
iterator
to a new object applying the function
on next()
.Constructor and Description |
---|
FunctionIterator(AutoCloseable closeable,
Iterable<T> iterable,
java.util.function.Function<? super T,? extends V> function)
Construct an instance with the provided root object, iterable and function.
|
FunctionIterator(AutoCloseable closeable,
Iterator<T> newIterator,
java.util.function.Function<? super T,? extends V> function)
Construct an instance with the provided root object, iterator and function.
|
FunctionIterator(Iterable<T> iterable,
java.util.function.Function<? super T,? extends V> function)
Construct an instance with the provided iterable and function.
|
FunctionIterator(Iterator<T> newIterator,
java.util.function.Function<? super T,? extends V> function)
Construct an instance with the provided iterator and function.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
hasNext() |
V |
next() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, remove
public FunctionIterator(Iterable<T> iterable, java.util.function.Function<? super T,? extends V> function)
iterable
- the iterable.function
- the function.public FunctionIterator(@Nullable AutoCloseable closeable, Iterable<T> iterable, java.util.function.Function<? super T,? extends V> function)
closeable
- an AutoCloseable
to close when iteration is complete.iterable
- the iterable.function
- the function.public FunctionIterator(Iterator<T> newIterator, java.util.function.Function<? super T,? extends V> function)
newIterator
- the iterator.function
- the function.public FunctionIterator(@Nullable AutoCloseable closeable, Iterator<T> newIterator, java.util.function.Function<? super T,? extends V> function)
closeable
- an AutoCloseable
to close when iteration is complete.newIterator
- the iterator.function
- the function.