net.sf.molae.pipe.trafo
Class TransformIterator<S,E>

java.lang.Object
  extended by 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

Constructor Summary
TransformIterator(Iterator<S> base, TwoWayTransformer<? super S,? extends E> transformer)
          Constructs a new TransformIterator object.
 
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
 

Constructor Detail

TransformIterator

public TransformIterator(Iterator<S> base,
                         TwoWayTransformer<? super S,? extends E> transformer)
Constructs a new TransformIterator object.

Parameters:
base - the underlying iterator
transformer - the underlying transformer
Throws:
NullPointerException - if any of the specified objects is null.
Method Detail

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>