public class TransformIterator<I,O>
extends java.lang.Object
implements java.util.Iterator<O>
Constructor and Description |
---|
TransformIterator()
Constructs a new
TransformIterator that will not function
until the setIterator and
setTransformer(Transformer) methods are invoked. |
TransformIterator(java.util.Iterator<? extends I> iterator)
Constructs a new
TransformIterator that won't transform
elements from the given iterator. |
TransformIterator(java.util.Iterator<? extends I> iterator,
Transformer<? super I,? extends O> transformer)
Constructs a new
TransformIterator that will use the
given iterator and transformer. |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<? extends I> |
getIterator()
Gets the iterator this iterator is using.
|
Transformer<? super I,? extends O> |
getTransformer()
Gets the transformer this iterator is using.
|
boolean |
hasNext() |
O |
next()
Gets the next object from the iteration, transforming it using the
current transformer.
|
void |
remove() |
void |
setIterator(java.util.Iterator<? extends I> iterator)
Sets the iterator for this iterator to use.
|
void |
setTransformer(Transformer<? super I,? extends O> transformer)
Sets the transformer this the iterator to use.
|
public TransformIterator()
TransformIterator
that will not function
until the setIterator
and
setTransformer(Transformer)
methods are invoked.public TransformIterator(java.util.Iterator<? extends I> iterator)
TransformIterator
that won't transform
elements from the given iterator.iterator
- the iterator to usepublic TransformIterator(java.util.Iterator<? extends I> iterator, Transformer<? super I,? extends O> transformer)
TransformIterator
that will use the
given iterator and transformer. If the given transformer is null,
then objects will not be transformed.iterator
- the iterator to usetransformer
- the transformer to usepublic boolean hasNext()
hasNext
in interface java.util.Iterator<O>
public O next()
next
in interface java.util.Iterator<O>
java.util.NoSuchElementException
- if there are no more elementspublic void remove()
remove
in interface java.util.Iterator<O>
public java.util.Iterator<? extends I> getIterator()
public void setIterator(java.util.Iterator<? extends I> iterator)
iterator
- the iterator to usepublic Transformer<? super I,? extends O> getTransformer()
public void setTransformer(Transformer<? super I,? extends O> transformer)
transformer
- the transformer to use"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"