- All Superinterfaces:
- AutoCloseable, Closeable
- All Known Implementing Classes:
- ExecuteWhenDoneYielder, ResourceClosingYielder
public interface Yielder<T>
extends Closeable
A Yielder is an object that tries to act like the yield() command/continuations in other languages. It's not
necessarily good at this job, but it works. I think.
Essentially, you can think of a Yielder as a linked list of items where the Yielder gives you access to the current
head via get() and it will give you another Yielder representing the next item in the chain via next(). A Yielder
that isDone() may return anything from both get() and next(), there is no contract and depending on those return
values will likely lead to bugs.
Once next is called, there is no guarantee and no requirement that references to old Yielder objects will continue
to obey the contract.
Yielders are Closeable and *must* be closed in order to prevent resource leaks. Once close() is called, the behavior
of the whole chain of Yielders is undefined.