java.lang.Object
org.bsc.async.AsyncGenerator.Base<E>
org.bsc.async.AsyncGenerator.BaseCancellable<E>
org.bsc.async.AsyncGenerator.WithResult<E>
- Type Parameters:
E- the type of elements in the generator
- All Implemented Interfaces:
Iterable<E>,AsyncGenerator<E>,AsyncGenerator.Cancellable<E>,AsyncGenerator.HasResultValue,AsyncGenerator.IsCancellable
- Enclosing interface:
- AsyncGenerator<E>
public static class AsyncGenerator.WithResult<E>
extends AsyncGenerator.BaseCancellable<E>
implements AsyncGenerator.HasResultValue
An asynchronous generator decorator that allows retrieving the result value of the asynchronous operation, if any.
-
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
Constructors -
Method Summary
Methods inherited from class org.bsc.async.AsyncGenerator.BaseCancellable
isCancelledMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bsc.async.AsyncGenerator
flatMap, forEachAsync, iterator, map, reduce, reduceAsync, stream, toCompletableFutureMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
WithResult
-
-
Method Details
-
delegate
-
executor
- Specified by:
executorin interfaceAsyncGenerator<E>- Overrides:
executorin classAsyncGenerator.Base<E>
-
resultValue
Retrieves the result value of the generator, if any.- Specified by:
resultValuein interfaceAsyncGenerator.HasResultValue- Returns:
- an
Optionalcontaining the result value if present, or an empty Optional if not
-
next
Description copied from interface:AsyncGeneratorRetrieves the next asynchronous element.- Specified by:
nextin interfaceAsyncGenerator<E>- Returns:
- the next element from the generator
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Description copied from interface:AsyncGenerator.IsCancellablemethod that request to cancel generator- Specified by:
cancelin interfaceAsyncGenerator.IsCancellable- Overrides:
cancelin classAsyncGenerator.BaseCancellable<E>
-