java.lang.Object
org.bsc.async.AsyncGenerator.Base<E>
org.bsc.async.AsyncGenerator.BaseCancellable<E>
org.bsc.async.AsyncGeneratorQueue.Generator<E>
- Type Parameters:
E
- the type of elements in the queue
- All Implemented Interfaces:
Iterable<E>
,AsyncGenerator<E>
,AsyncGenerator.Cancellable<E>
,AsyncGenerator.IsCancellable
- Enclosing class:
- AsyncGeneratorQueue
Inner class to generate asynchronous elements from the queue.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bsc.async.AsyncGenerator
AsyncGenerator.Base<E>, AsyncGenerator.BaseCancellable<E>, AsyncGenerator.Cancellable<E>, AsyncGenerator.Data<E>, AsyncGenerator.Embed<E>, AsyncGenerator.EmbedCompletionHandler, AsyncGenerator.HasResultValue, AsyncGenerator.IsCancellable, AsyncGenerator.WithEmbed<E>, AsyncGenerator.WithResult<E>
-
Field Summary
Fields inherited from interface org.bsc.async.AsyncGenerator.IsCancellable
CANCELLED
-
Constructor Summary
ConstructorsConstructorDescriptionGenerator
(BlockingQueue<AsyncGenerator.Data<E>> queue) Constructs a Generator with the specified queue. -
Method Summary
Methods inherited from class org.bsc.async.AsyncGenerator.BaseCancellable
isCancelled
Methods inherited from class org.bsc.async.AsyncGenerator.Base
executor
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bsc.async.AsyncGenerator
executor, flatMap, forEachAsync, iterator, map, reduce, reduceAsync, stream, toCompletableFuture
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Generator
Constructs a Generator with the specified queue.- Parameters:
queue
- the blocking queue to generate elements from
-
-
Method Details
-
queue
-
next
Retrieves the next element from the queue asynchronously.- Returns:
- the next element from the queue
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Description copied from interface:AsyncGenerator.IsCancellable
method that request to cancel generator- Specified by:
cancel
in interfaceAsyncGenerator.IsCancellable
- Overrides:
cancel
in classAsyncGenerator.BaseCancellable<E>
-