net.sf.molae.pipe.trafo
Class TransformIterator<S,E>
java.lang.Object
net.sf.molae.pipe.trafo.TransformIterator<S,E>
- All Implemented Interfaces:
- Iterator<E>
public class TransformIterator<S,E>
- extends Object
- implements Iterator<E>
Transforms each element of an iterator.
- Since:
- 2.0
Method Summary |
boolean |
hasNext()
|
E |
next()
Gets the next object from the iteration, transforming it using the
underlying transformer. |
void |
remove()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransformIterator
public TransformIterator(Iterator<S> base,
TwoWayTransformer<? super S,? extends E> transformer)
- Constructs a new TransformIterator object.
- Parameters:
base
- the underlying iteratortransformer
- the underlying transformer
- Throws:
NullPointerException
- if any of the specified objects is
null
.
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<E>
next
public E next()
- Gets the next object from the iteration, transforming it using the
underlying transformer.
- Specified by:
next
in interface Iterator<E>
- Returns:
- the transformed next object
- Throws:
NoSuchElementException
- iteration has no more elements
remove
public void remove()
- Specified by:
remove
in interface Iterator<E>