@Override
                    /**
                     * Iterator's finalize() can be used to tell when it is out of scope, and the
                     * collecting thread can be terminated.
                     */
                    protected void finalize() throws Throwable {
                        close();
                        super.finalize();
                    }
Convert a method that implements the Collector<> class with a standard Iterable<>. This means
that the collecting method can use complex recursive logic, but still allows the calling code
to handle the results with a standard iterator. Results are returned immediately and do not
incur overhead of being stored in a list. Calculation overhead is only performed for the
results that are requested through the iterator.

This is implemented using a new thread created for the collection process, and a
SynchronousQueue<> object.
jphp-runtime/src/php/runtime/util/generator/ThreadedYieldAdapter.java