Package io.activej.async.function
Interface AsyncSupplier<T>
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface AsyncSupplier<T>
Represents asynchronous supplier that returnsPromiseof some data.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default @NotNull AsyncSupplier<T>async()Ensures that suppliedPromisewill complete asynchronously.Promise<T>get()GetsPromiseof data item asynchronously.default <V> @NotNull AsyncSupplier<V>map(@NotNull Function<? super T,? extends V> fn)Applies function before supplying aPromise.default <V> @NotNull AsyncSupplier<V>mapAsync(@NotNull Function<? super T,? extends Promise<V>> fn)Applies function to the result of suppliedPromise.static <T> AsyncSupplier<T>of(@NotNull Supplier<Promise<T>> supplier)static <T> AsyncSupplier<T>ofAsyncSupplierIterable(@NotNull Iterable<? extends AsyncSupplier<T>> iterable)static <T> AsyncSupplier<T>ofAsyncSupplierIterator(@NotNull Iterator<? extends AsyncSupplier<T>> iterator)static <T> AsyncSupplier<T>ofAsyncSupplierStream(@NotNull Stream<? extends AsyncSupplier<T>> stream)static <T> AsyncSupplier<T>ofIterable(@NotNull Iterable<? extends T> iterable)static <T> AsyncSupplier<T>ofIterator(@NotNull Iterator<? extends T> iterator)static <T> AsyncSupplier<T>ofPromise(@NotNull Promise<T> promise)static <T> AsyncSupplier<T>ofPromiseIterable(@NotNull Iterable<? extends Promise<T>> iterable)static <T> AsyncSupplier<T>ofPromiseIterator(@NotNull Iterator<? extends Promise<T>> iterator)static <T> AsyncSupplier<T>ofPromiseStream(@NotNull Stream<? extends Promise<T>> stream)static <T> AsyncSupplier<T>ofStream(@NotNull Stream<? extends T> stream)static <T> AsyncSupplier<T>ofValue(T value)default @NotNull AsyncSupplier<T>peek(@NotNull Consumer<? super T> action)default @NotNull AsyncSupplier<T>peekEx(@NotNull Callback<T> action)default @NotNull AsyncSupplier<io.activej.common.collection.Try<T>>toTry()default @NotNull AsyncSupplier<Void>toVoid()default <R> RtransformWith(@NotNull Function<AsyncSupplier<T>,R> fn)default @NotNull AsyncSupplier<T>withExecutor(@NotNull AsyncExecutor asyncExecutor)
-
-
-
Method Detail
-
of
static <T> AsyncSupplier<T> of(@NotNull @NotNull Supplier<Promise<T>> supplier)
-
ofValue
static <T> AsyncSupplier<T> ofValue(@Nullable T value)
-
ofIterator
static <T> AsyncSupplier<T> ofIterator(@NotNull @NotNull Iterator<? extends T> iterator)
-
ofStream
static <T> AsyncSupplier<T> ofStream(@NotNull @NotNull Stream<? extends T> stream)
-
ofIterable
static <T> AsyncSupplier<T> ofIterable(@NotNull @NotNull Iterable<? extends T> iterable)
-
ofPromise
static <T> AsyncSupplier<T> ofPromise(@NotNull @NotNull Promise<T> promise)
-
ofPromiseIterator
static <T> AsyncSupplier<T> ofPromiseIterator(@NotNull @NotNull Iterator<? extends Promise<T>> iterator)
-
ofPromiseIterable
static <T> AsyncSupplier<T> ofPromiseIterable(@NotNull @NotNull Iterable<? extends Promise<T>> iterable)
-
ofPromiseStream
static <T> AsyncSupplier<T> ofPromiseStream(@NotNull @NotNull Stream<? extends Promise<T>> stream)
-
ofAsyncSupplierIterator
static <T> AsyncSupplier<T> ofAsyncSupplierIterator(@NotNull @NotNull Iterator<? extends AsyncSupplier<T>> iterator)
-
ofAsyncSupplierIterable
static <T> AsyncSupplier<T> ofAsyncSupplierIterable(@NotNull @NotNull Iterable<? extends AsyncSupplier<T>> iterable)
-
ofAsyncSupplierStream
static <T> AsyncSupplier<T> ofAsyncSupplierStream(@NotNull @NotNull Stream<? extends AsyncSupplier<T>> stream)
-
transformWith
@Contract(pure=true) @NotNull default <R> R transformWith(@NotNull @NotNull Function<AsyncSupplier<T>,R> fn)
-
async
@Contract(pure=true) @NotNull default @NotNull AsyncSupplier<T> async()
Ensures that suppliedPromisewill complete asynchronously.- Returns:
AsyncSupplierofPromises that will be completed asynchronously- See Also:
Promise.async()
-
toVoid
@Contract(pure=true) @NotNull default @NotNull AsyncSupplier<Void> toVoid()
-
toTry
@Contract(pure=true) @NotNull default @NotNull AsyncSupplier<io.activej.common.collection.Try<T>> toTry()
-
withExecutor
@Contract(pure=true) @NotNull default @NotNull AsyncSupplier<T> withExecutor(@NotNull @NotNull AsyncExecutor asyncExecutor)
-
peek
@Contract(pure=true) @NotNull default @NotNull AsyncSupplier<T> peek(@NotNull @NotNull Consumer<? super T> action)
-
peekEx
@Contract(pure=true) @NotNull default @NotNull AsyncSupplier<T> peekEx(@NotNull @NotNull Callback<T> action)
-
map
@Contract(pure=true) @NotNull default <V> @NotNull AsyncSupplier<V> map(@NotNull @NotNull Function<? super T,? extends V> fn)
Applies function before supplying aPromise.- Parameters:
fn- function to be applied to the result ofPromise- Returns:
AsyncSupplierofPromises after transformation
-
mapAsync
@Contract(pure=true) @NotNull default <V> @NotNull AsyncSupplier<V> mapAsync(@NotNull @NotNull Function<? super T,? extends Promise<V>> fn)
Applies function to the result of suppliedPromise.- Parameters:
fn- function to be applied to the result ofPromise
-
-