Package io.activej.async.function
Interface AsyncConsumer<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 AsyncConsumer<T>
Represents an asynchronous consumer that consumes data items.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NotNull Promise<Void>accept(T value)Consumes some data asynchronously.default @NotNull AsyncConsumer<T>async()default <V> @NotNull AsyncConsumer<V>map(@NotNull Function<? super V,? extends T> fn)default <V> @NotNull AsyncConsumer<V>mapAsync(@NotNull Function<? super V,? extends Promise<T>> fn)static <T> @NotNull AsyncConsumer<T>of(@NotNull Consumer<? super T> consumer)Wraps standard Java'sConsumerinterface.default @NotNull AsyncConsumer<T>peek(@NotNull Consumer<T> action)default <R> RtransformWith(@NotNull Function<AsyncConsumer<T>,R> fn)default @NotNull AsyncConsumer<T>withExecutor(@NotNull AsyncExecutor asyncExecutor)
-
-
-
Method Detail
-
of
@NotNull static <T> @NotNull AsyncConsumer<T> of(@NotNull @NotNull Consumer<? super T> consumer)
Wraps standard Java'sConsumerinterface.- Parameters:
consumer- - Java'sConsumerof Promises- Returns:
AsyncConsumerthat works on top of standard Java'sConsumerinterface
-
transformWith
@Contract(pure=true) @NotNull default <R> R transformWith(@NotNull @NotNull Function<AsyncConsumer<T>,R> fn)
-
async
@Contract(pure=true) @NotNull default @NotNull AsyncConsumer<T> async()
-
withExecutor
@Contract(pure=true) @NotNull default @NotNull AsyncConsumer<T> withExecutor(@NotNull @NotNull AsyncExecutor asyncExecutor)
-
peek
@Contract(pure=true) @NotNull default @NotNull AsyncConsumer<T> peek(@NotNull @NotNull Consumer<T> action)
-
map
@Contract(pure=true) @NotNull default <V> @NotNull AsyncConsumer<V> map(@NotNull @NotNull Function<? super V,? extends T> fn)
-
mapAsync
@Contract(pure=true) @NotNull default <V> @NotNull AsyncConsumer<V> mapAsync(@NotNull @NotNull Function<? super V,? extends Promise<T>> fn)
-
-