Interface BiConsumer<T,U>

Type Parameters:
T - the first parameter type
U - the second parameter type
All Superinterfaces:
BiConsumer<T,U>

public interface BiConsumer<T,U> extends BiConsumer<T,U>
An enhanced binary consumer.
Author:
Paul Ferraro
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BiConsumer<?,?>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default BiConsumer<T,U>
    andThen(BiConsumer<? super T,? super U> after)
     
    default <V1, V2> BiConsumer<V1,V2>
    compose(Function<V1,T> mapper1, Function<V2,U> mapper2)
    Composes a consumer this consumer using result of the specified mapping functions.
    static <T, U> BiConsumer<T,U>
    Returns a consumer that performs no action.
    static <T, U> BiConsumer<T,U>
    former(Consumer<? super T> consumer)
    Returns a consumer that delegates to a consumer of the first parameter, ignoring the second.
    static <T, U> BiConsumer<T,U>
    latter(Consumer<? super U> consumer)
    Returns a consumer that delegates to a consumer of the second parameter, ignoring the first.
    static <T, U> BiConsumer<T,U>
    of(Iterable<BiConsumer<? super T,? super U>> consumers)
    Returns a composite consumer that delegates to zero or more consumers.
    static <T, U> BiConsumer<T,U>
    of(Consumer<? super T> consumer1, Consumer<? super U> consumer2)
    Returns a composite consumer that delegates to a consumer per parameter.
    default BiConsumer<U,T>
    Returns a consumer that processes this consumer with reversed parameter order.

    Methods inherited from interface java.util.function.BiConsumer

    accept
  • Field Details

  • Method Details

    • andThen

      default BiConsumer<T,U> andThen(BiConsumer<? super T,? super U> after)
      Specified by:
      andThen in interface BiConsumer<T,U>
    • compose

      default <V1, V2> BiConsumer<V1,V2> compose(Function<V1,T> mapper1, Function<V2,U> mapper2)
      Composes a consumer this consumer using result of the specified mapping functions.
      Type Parameters:
      V1 - the former mapped type
      V2 - the latter mapped type
      Parameters:
      mapper1 - a mapping function for the former parameter
      mapper2 - a mapping function for the latter parameter
      Returns:
      a mapped consumer
    • reverse

      default BiConsumer<U,T> reverse()
      Returns a consumer that processes this consumer with reversed parameter order.
      Returns:
      a consumer that processes this consumer with reversed parameter order.
    • empty

      static <T, U> BiConsumer<T,U> empty()
      Returns a consumer that performs no action.
      Type Parameters:
      T - the first consumed type
      U - the second consumed type
      Returns:
      an empty consumer
    • of

      static <T, U> BiConsumer<T,U> of(Iterable<BiConsumer<? super T,? super U>> consumers)
      Returns a composite consumer that delegates to zero or more consumers.
      Type Parameters:
      T - the first consumed type
      U - the second consumed type
      Parameters:
      consumers - zero or more consumers
      Returns:
      a composite consumer
    • former

      static <T, U> BiConsumer<T,U> former(Consumer<? super T> consumer)
      Returns a consumer that delegates to a consumer of the first parameter, ignoring the second.
      Type Parameters:
      T - the first consumed type
      U - the second consumed type
      Parameters:
      consumer - the consumer of the first parameter
      Returns:
      a consumer of the first parameter
    • latter

      static <T, U> BiConsumer<T,U> latter(Consumer<? super U> consumer)
      Returns a consumer that delegates to a consumer of the second parameter, ignoring the first.
      Type Parameters:
      T - the first consumed type
      U - the second consumed type
      Parameters:
      consumer - the consumer of the second parameter
      Returns:
      a consumer that delegates to a consumer of the second parameter, ignoring the first.
    • of

      static <T, U> BiConsumer<T,U> of(Consumer<? super T> consumer1, Consumer<? super U> consumer2)
      Returns a composite consumer that delegates to a consumer per parameter.
      Type Parameters:
      T - the first consumed type
      U - the second consumed type
      Parameters:
      consumer1 - the consumer of the first parameter
      consumer2 - the consumer of the second parameter
      Returns:
      a composite consumer