Class TransformingIterator<T1,​T2>

  • Type Parameters:
    T1 - The element type of the delegate iterator
    T2 - The element type of this iterator
    All Implemented Interfaces:
    java.util.Iterator<T2>

    public abstract class TransformingIterator<T1,​T2>
    extends java.lang.Object
    implements java.util.Iterator<T2>
    An Iterator that transforms its elements on-the-fly.
    • Constructor Summary

      Constructors 
      Constructor Description
      TransformingIterator​(java.util.Iterator<? extends T1> delegate)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      T2 next()  
      void remove()  
      protected abstract T2 transform​(T1 o)
      Derived classes must implement this method such that it does the desired transformation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • TransformingIterator

        public TransformingIterator​(java.util.Iterator<? extends T1> delegate)
    • Method Detail

      • hasNext

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

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

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

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