| Modifier and Type | Interface and Description |
|---|---|
static class |
AsyncGenerator.Data<E>
Represents a data element in the AsyncGenerator.
|
| Modifier and Type | Method and Description |
|---|---|
static <E,U> AsyncGenerator<U> |
collect(Collection<E> collection,
BiConsumer<E,Consumer<CompletableFuture<U>>> consumer)
Collects asynchronous elements from a collection.
|
static <E,U> AsyncGenerator<U> |
collect(Iterator<E> iterator,
BiConsumer<E,Consumer<CompletableFuture<U>>> consumer)
Collects asynchronous elements from an iterator.
|
default <R extends List<E>> |
collectAsync(R result,
Consumer<E> consumer)
Collects elements from the AsyncGenerator asynchronously into a list.
|
static <E> AsyncGenerator<E> |
empty()
Returns an empty AsyncGenerator.
|
default CompletableFuture<Void> |
forEachAsync(Consumer<E> consumer)
Asynchronously iterates over the elements of the AsyncGenerator and applies the given consumer to each element.
|
default Iterator<E> |
iterator()
Returns an iterator over the elements of this AsyncGenerator.
|
static <E,U> AsyncGenerator<U> |
map(Collection<E> collection,
Function<E,CompletableFuture<U>> mapFunction)
create a generator, mapping each element to an asynchronous counterpart.
|
static <E,U> AsyncGenerator<U> |
map(Iterator<E> iterator,
Function<E,CompletableFuture<U>> mapFunction)
create a generator, mapping each element to an asynchronous counterpart.
|
AsyncGenerator.Data<E> |
next()
Retrieves the next asynchronous element.
|
default Stream<E> |
stream()
Returns a sequential Stream with the elements of this AsyncGenerator.
|
default CompletableFuture<Void> |
toCompletableFuture()
Converts the AsyncGenerator to a CompletableFuture.
|
forEach, spliteratorAsyncGenerator.Data<E> next()
static <E> AsyncGenerator<E> empty()
E - the type of elementsstatic <E,U> AsyncGenerator<U> map(Iterator<E> iterator, Function<E,CompletableFuture<U>> mapFunction)
E - the type of elements in the collectionU - the type of elements in the CompletableFutureiterator - the elements iteratormapFunction - the function to map elements to CompletableFuturestatic <E,U> AsyncGenerator<U> collect(Iterator<E> iterator, BiConsumer<E,Consumer<CompletableFuture<U>>> consumer)
E - the type of elements in the iteratorU - the type of elements in the CompletableFutureiterator - the iterator containing elements to collectconsumer - the function to consume elements and add them to the accumulatorstatic <E,U> AsyncGenerator<U> map(Collection<E> collection, Function<E,CompletableFuture<U>> mapFunction)
E - the type of elements in the collectionU - the type of elements in the CompletableFuturecollection - the collection of elements to mapmapFunction - the function to map elements to CompletableFuturestatic <E,U> AsyncGenerator<U> collect(Collection<E> collection, BiConsumer<E,Consumer<CompletableFuture<U>>> consumer)
E - the type of elements in the iteratorU - the type of elements in the CompletableFuturecollection - the iterator containing elements to collectconsumer - the function to consume elements and add them to the accumulatordefault CompletableFuture<Void> toCompletableFuture()
default CompletableFuture<Void> forEachAsync(Consumer<E> consumer)
consumer - the consumer function to be applied to each elementdefault <R extends List<E>> CompletableFuture<R> collectAsync(R result, Consumer<E> consumer)
R - the type of the result listresult - the result list to collect elements intoconsumer - the consumer function for processing elementsdefault Stream<E> stream()
Copyright © 2024. All rights reserved.