Class FlattenedIterator<O,I>
java.lang.Object
generic.util.FlattenedIterator<O,I>
- Type Parameters:
O- the type of elements in the outer iteratorI- the type of elements in the inner and flattened iterators
- All Implemented Interfaces:
Iterator<I>
- Direct Known Subclasses:
AddressIteratorAdapter
-
Field Details
-
outer
-
innerFactory
-
inner
-
preppedInner
-
-
Constructor Details
-
FlattenedIterator
-
-
Method Details
-
start
public static <O,I> Iterator<I> start(Iterator<O> outer, Function<O, Iterator<? extends I>> innerFactory) Create a flattened iteratorThis iterates over each element of
outerand applies the giveninnerFactoryto generate an "inner" iterator. The returned iterator will produce elements from the inner iterators as if concatentated. This is essentially a flat-map operation on iterators. Note theinnerFactorymay return null to skip an outer element.- Type Parameters:
O- the type of elements in the outer iteratorI- the type of elements in the inner and flattened iterators- Parameters:
outer- the outer iteratorinnerFactory- a mapping from outer elements to inner iterators- Returns:
- the flattened iterator
-
hasNext
-
next
-
remove
-