org.apache.commons.functor.generator
Class IteratorToGeneratorAdapter<E>

java.lang.Object
  extended by org.apache.commons.functor.generator.BaseGenerator<E>
      extended by org.apache.commons.functor.generator.IteratorToGeneratorAdapter<E>
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: 1156798 $ $Date: 2011-08-11 22:11:07 +0200 (Thu, 11 Aug 2011) $
Author:
Jason Horman (jason@jhorman.org), Rodney Waldhoff

Constructor Summary
IteratorToGeneratorAdapter(Iterator<? extends E> iter)
          Create a new IteratorToGeneratorAdapter.
 
Method Summary
static
<E> IteratorToGeneratorAdapter<E>
adapt(Iterator<? extends E> iter)
          Adapt an Iterator to the Generator interface.
 boolean equals(Object obj)
          
 int hashCode()
          
 void run(UnaryProcedure<? super E> proc)
          Generators must implement this method.
 String toString()
          
 
Methods inherited from class org.apache.commons.functor.generator.BaseGenerator
getWrappedGenerator, isStopped, stop, to, to, toCollection
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IteratorToGeneratorAdapter

public IteratorToGeneratorAdapter(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(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

adapt

public static <E> IteratorToGeneratorAdapter<E> adapt(Iterator<? extends E> iter)
Adapt an Iterator to the Generator interface.

Parameters:
iter - to adapt
Returns:
IteratorToGeneratorAdapter


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.