public final class GeneratorBridge<T>
extends Object
implements Iterator, Closeable
A producer/consumer bridge for async generators (yield return).
The generator closure runs on a separate thread and calls yield(Object)
to produce values. The consumer iterates using hasNext()/next().
A SynchronousQueue provides the handoff — each yield blocks
until the consumer takes the value, providing natural back-pressure.
With virtual threads (JDK 21+), both the producer and consumer block cheaply. On JDK 17-20, the producer runs on a platform thread from the cached pool.
T - the element type