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 returns Promise of some data.
    • Method Detail

      • 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)
      • 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 supplied Promise will complete asynchronously.
        Returns:
        AsyncSupplier of Promises 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 a Promise.
        Parameters:
        fn - function to be applied to the result of Promise
        Returns:
        AsyncSupplier of Promises 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 supplied Promise.
        Parameters:
        fn - function to be applied to the result of Promise