java.lang.Object
de.zabuza.fastcdc4j.internal.util.FlatIterator<X,Y>
- Type Parameters:
X- The type contained in the outer iterator, either already an iterator or used to produce iterators using a given functionY- The type contained in the inner iterators, also the final type contained in this iterator
- All Implemented Interfaces:
java.util.Iterator<Y>
public final class FlatIterator<X,Y>
extends java.lang.Object
implements java.util.Iterator<Y>
Iterator that flattens an iterator over other iterators. The given iterator is consumed on-the-fly.
Use new FlatIterator(outer, Function::identity) if FlatIterator is already the inner iterator.
- Author:
- Daniel Tischner <zabuza.dev@gmail.com>
-
Constructor Summary
Constructors Constructor Description FlatIterator(java.util.Iterator<? extends X> outerIterator, java.util.function.Function<? super X,? extends java.util.Iterator<Y>> provider)Creates a new flat iterator that flattens the given iterator on-the-fly. -
Method Summary
-
Constructor Details
-
FlatIterator
public FlatIterator(java.util.Iterator<? extends X> outerIterator, java.util.function.Function<? super X,? extends java.util.Iterator<Y>> provider)Creates a new flat iterator that flattens the given iterator on-the-fly.- Parameters:
outerIterator- The source iterator used to generate inner iterators from, not nullprovider- Function that provides the final inner iterators based on the outer iterators data, not null
-
-
Method Details