Class IteratorToGeneratorAdapter<E>

  • Type Parameters:
    E - the type of elements held in this generator.
    All Implemented Interfaces:
    Generator<E>

    public final class IteratorToGeneratorAdapter<E>
    extends BaseGenerator<E>
    Adapts an Iterator to the Generator interface.
    Since:
    1.0
    Version:
    $Revision$ $Date$
    • Field Detail

      • iter

        private final java.util.Iterator<? extends E> iter
        The adapted iterator.
    • Constructor Detail

      • IteratorToGeneratorAdapter

        public IteratorToGeneratorAdapter​(java.util.Iterator<? extends E> iter)
        Create a new IteratorToGeneratorAdapter.
        Parameters:
        iter - Iterator to adapt
    • Method Detail

      • run

        public void run​(UnaryProcedure<? super E> proc)
        Generators must implement this method.
        Parameters:
        proc - UnaryProcedure to run
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • adapt

        public static <E> IteratorToGeneratorAdapter<E> adapt​(java.util.Iterator<? extends E> iter)
        Adapt an Iterator to the Generator interface.
        Type Parameters:
        E - the type of elements held in this generator.
        Parameters:
        iter - to adapt
        Returns:
        IteratorToGeneratorAdapter