jfun.util.yield
Class Continuator

java.lang.Object
  extended by jfun.util.yield.Continuator
All Implemented Interfaces:
java.util.Iterator

public final class Continuator
extends java.lang.Object
implements java.util.Iterator

This class implements java.util.Iterator using a jfun.util.Iterable. It transforms an internal iterator to an external iterator by using a background Thead.

Zephyr Business Solution

Author:
Ben Yu

Constructor Summary
Continuator(Iterable it)
          Creates a Continuator object.
 
Method Summary
 void close()
          Closes the the iterator and releases all resources used in the iteration.
 boolean equals(java.lang.Object obj)
           
protected  void finalize()
          Cleans up the background thread.
 int hashCode()
           
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
          Throws UnsupportedOperationException
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Continuator

public Continuator(Iterable it)
Creates a Continuator object.

Parameters:
it - the Iterable object.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Throws UnsupportedOperationException

Specified by:
remove in interface java.util.Iterator

finalize

protected void finalize()
Cleans up the background thread.

Overrides:
finalize in class java.lang.Object

close

public void close()
Closes the the iterator and releases all resources used in the iteration. hasNext() returns false and next() throws NoSuchElementException after close().


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