Class ConverterIterator<T1,T2>
- java.lang.Object
-
- com.saperion.common.lang.iterator.ConverterIterator<T1,T2>
-
- Type Parameters:
T1
- type of input objectsT2
- type of converted objects
- All Implemented Interfaces:
java.util.Iterator<T2>
public final class ConverterIterator<T1,T2> extends java.lang.Object implements java.util.Iterator<T2>
An
Iterator
that converts the objects of an existing iterator using aConverter
.Iterator.remove()
is not supported.- Author:
- agz
- See Also:
Converter
-
-
Constructor Summary
Constructors Constructor Description ConverterIterator(java.util.Iterator<? extends T1> iterator, Converter<? super T1,? extends T2> converter)
Creates a newConverterIterator
, that converts the objects of the specified iterator using the specifiedConverter
.
-
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
-
ConverterIterator
public ConverterIterator(java.util.Iterator<? extends T1> iterator, Converter<? super T1,? extends T2> converter)
Creates a newConverterIterator
, that converts the objects of the specified iterator using the specifiedConverter
. The specified iterator must not benull
. The specified converter must not benull
.- Parameters:
iterator
- underlying iterator whose iteration should be convertedconverter
-Converter
-
-