Class TransformingIterator<T1,T2>

java.lang.Object
org.codehaus.commons.compiler.util.iterator.TransformingIterator<T1,T2>
Type Parameters:
T1 - The element type of the delegate iterator
T2 - The element type of this iterator
All Implemented Interfaces:
Iterator<T2>

public abstract class TransformingIterator<T1,T2> extends Object implements Iterator<T2>
An Iterator that transforms its elements on-the-fly.
  • Field Details

    • delegate

      private final Iterator<? extends T1> delegate
  • Constructor Details

    • TransformingIterator

      public TransformingIterator(Iterator<? extends T1> delegate)
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T1>
    • next

      public final T2 next()
      Specified by:
      next in interface Iterator<T1>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<T1>
    • transform

      protected abstract T2 transform(T1 o)
      Derived classes must implement this method such that it does the desired transformation.