|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections.iterators.TransformIterator<I,O>
public class TransformIterator<I,O>
Decorates an iterator such that each element returned is transformed.
Constructor Summary | |
---|---|
TransformIterator()
Constructs a new TransformIterator that will not function
until the setIterator method is
invoked. |
|
TransformIterator(Iterator<I> iterator)
Constructs a new TransformIterator that won't transform
elements from the given iterator. |
|
TransformIterator(Iterator<I> iterator,
Transformer<I,O> transformer)
Constructs a new TransformIterator that will use the
given iterator and transformer. |
Method Summary | |
---|---|
Iterator<I> |
getIterator()
Gets the iterator this iterator is using. |
Transformer<I,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(Iterator<I> iterator)
Sets the iterator for this iterator to use. |
void |
setTransformer(Transformer<I,O> transformer)
Sets the transformer this the iterator to use. |
protected O |
transform(I source)
Transforms the given object using the transformer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TransformIterator()
TransformIterator
that will not function
until the setIterator
method is
invoked.
public TransformIterator(Iterator<I> iterator)
TransformIterator
that won't transform
elements from the given iterator.
iterator
- the iterator to usepublic TransformIterator(Iterator<I> iterator, Transformer<I,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 useMethod Detail |
---|
public boolean hasNext()
hasNext
in interface Iterator<O>
public O next()
next
in interface Iterator<O>
NoSuchElementException
- if there are no more elementspublic void remove()
remove
in interface Iterator<O>
public Iterator<I> getIterator()
public void setIterator(Iterator<I> iterator)
iterator
- the iterator to usepublic Transformer<I,O> getTransformer()
public void setTransformer(Transformer<I,O> transformer)
transformer
- the transformer to useprotected O transform(I source)
source
- the object to transform
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |