Modifier | Constructor and Description |
---|---|
protected |
CoIterator() |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
E |
next() |
protected void |
produce(E element)
Produces the next value to be returned by the
next() method. |
void |
remove()
Always throws UnsupportedOperationException.
|
protected abstract void |
run()
This is the body of the Iterator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public void remove() throws UnsupportedOperationException
remove
in interface Iterator<E>
UnsupportedOperationException
- alwaysprotected void produce(E element) throws SuspendableException
next()
method.element
- The value that should be returned by next()
SuspendableException
- This method will suspend the executionprotected abstract void run() throws SuspendableException
This is the body of the Iterator. This method is executed as a Coroutine
to produce(E)
the
values of the Iterator.
Note that this method is suspended each time it calls produce. And if the consumer does not consume all values of the Iterator then this method does not get the change to finish it's execution. This also includes the finally blocks.
This method must only suspend by calling produce. Any other reason for suspension will cause a busy loop in the Iterator.
SuspendableException
Copyright © 2015 Rice University - Department of Computer Science. All rights reserved.