Interface AsyncConsumer<T>

All Superinterfaces:
AsyncConsumerEx<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> extends AsyncConsumerEx<T>
Represents an asynchronous consumer that consumes data items.
  • Method Summary

    Modifier and Type
    Method
    Description
    accept(T value)
    Consumes some data asynchronously.
    static <T> AsyncConsumer<T>
    of(io.activej.common.function.ConsumerEx<? super T> consumer)
    Wraps a ConsumerEx interface.
    static <T> AsyncConsumer<T>
    sanitize(AsyncConsumerEx<? super T> consumer)
     
  • Method Details

    • accept

      Promise<Void> accept(T value)
      Consumes some data asynchronously.
      Specified by:
      accept in interface AsyncConsumerEx<T>
      Parameters:
      value - value to be consumed
      Returns:
      Promise of Void that represents successful consumption of data
    • of

      static <T> AsyncConsumer<T> of(io.activej.common.function.ConsumerEx<? super T> consumer)
      Wraps a ConsumerEx interface.
      Parameters:
      consumer - a ConsumerEx
      Returns:
      AsyncConsumer that works on top of ConsumerEx interface
    • sanitize

      static <T> AsyncConsumer<T> sanitize(AsyncConsumerEx<? super T> consumer)