net.ericaro.neoitertools.generators
Class YieldGenerator<T>

java.lang.Object
  extended by net.ericaro.neoitertools.generators.YieldGenerator<T>
All Implemented Interfaces:
Generator<T>

public class YieldGenerator<T>
extends java.lang.Object
implements Generator<T>

A Generator based on a Yield statement. It does not support return value from the yield statement so that it can support java standard Iterator protocol.

Author:
eric
See Also:
About Python vs Java Iterator Protocols., YieldGenerator's wiki page, neoitertools site

Constructor Summary
YieldGenerator(Yield<java.lang.Void,T> function)
           
 
Method Summary
 T next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YieldGenerator

public YieldGenerator(Yield<java.lang.Void,T> function)
Method Detail

next

public T next()
       throws java.util.NoSuchElementException
Specified by:
next in interface Generator<T>
Returns:
the next item in the sequence.
Throws:
java.util.NoSuchElementException - when sequence is exhausted.


Copyright © 2011. All Rights Reserved.