Package org.bsc.async
Class AsyncGenerator.WithResult<E>
- java.lang.Object
-
- org.bsc.async.AsyncGenerator.WithResult<E>
-
- Type Parameters:
E
- the type of elements in the generator
- All Implemented Interfaces:
Iterable<E>
,AsyncGenerator<E>
,AsyncGeneratorOperators<E>
- Enclosing interface:
- AsyncGenerator<E>
public static class AsyncGenerator.WithResult<E> extends Object implements AsyncGenerator<E>
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.Data<E>, AsyncGenerator.Embed<E>, AsyncGenerator.EmbedCompletionHandler, AsyncGenerator.WithEmbed<E>, AsyncGenerator.WithResult<E>
-
-
Field Summary
Fields Modifier and Type Field Description protected AsyncGenerator<E>
delegate
-
Constructor Summary
Constructors Constructor Description WithResult(AsyncGenerator<E> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncGenerator<E>
delegate()
AsyncGenerator.Data<E>
next()
Retrieves the next asynchronous element.Optional<Object>
resultValue()
Retrieves the result value of the generator, if any.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bsc.async.AsyncGenerator
async, collectAsync, collectAsync, iterator, stream, toCompletableFuture
-
Methods inherited from interface org.bsc.async.AsyncGeneratorOperators
collectAsync, executor, filter, flatMap, forEachAsync, map
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
delegate
protected final AsyncGenerator<E> delegate
-
-
Constructor Detail
-
WithResult
public WithResult(AsyncGenerator<E> delegate)
-
-
Method Detail
-
delegate
public AsyncGenerator<E> delegate()
-
resultValue
public Optional<Object> resultValue()
Retrieves the result value of the generator, if any.- Returns:
- an
Optional
containing the result value if present, or an empty Optional if not
-
next
public final AsyncGenerator.Data<E> next()
Description copied from interface:AsyncGenerator
Retrieves the next asynchronous element.- Specified by:
next
in interfaceAsyncGenerator<E>
- Specified by:
next
in interfaceAsyncGeneratorOperators<E>
- Returns:
- the next element from the generator
-
-