Class ExpandingSubLevelIterator<T1,T2>
- java.lang.Object
-
- com.saperion.common.lang.iterator.ExpandingSubLevelIterator<T1,T2>
-
- Type Parameters:
T1
- type of input objects of the main iteratorT2
- type of output objects and of the sub level iterators
- All Implemented Interfaces:
java.util.Iterator<T2>
public final class ExpandingSubLevelIterator<T1,T2> extends java.lang.Object implements java.util.Iterator<T2>
An
ExpandingSubLevelIterator
iterates through the sub level nodes of a virtual two level data structure.It iterates through the objects of the specified main iterator. For each such main level object a call to the specified
IteratorResolver
is executed to get an iterator for the optional virtual sub elements. If such an iterator is found, all the sub elements will be iterated through.Then, the main iterator will step to the next main object and its sub elements and so on.
Iterator.remove()
is not supported.- Author:
- agz
- See Also:
ExpandingNodeIterator
,ExpandingLeafIterator
-
-
Constructor Summary
Constructors Constructor Description ExpandingSubLevelIterator(java.util.Iterator<? extends T1> iterator, IteratorResolver<T1,T2> iteratorResolver)
Creates a newExpandingSubLevelIterator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
T2
next()
void
remove()
java.lang.String
toString()
-
-
-
Constructor Detail
-
ExpandingSubLevelIterator
public ExpandingSubLevelIterator(java.util.Iterator<? extends T1> iterator, IteratorResolver<T1,T2> iteratorResolver)
Creates a newExpandingSubLevelIterator
. The specified iterator and the specified iterator resolver must not benull
.- Parameters:
iterator
- main level iteratoriteratorResolver
-IteratorResolver
- See Also:
class documentation for details
-
-