Interface BiConsumer<T1,T2,E extends Exception>

Type Parameters:
T1 - the type of the first argument to the operation
T2 - the type of the second argument to the operation
E - the type of the exception that may be thrown
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 BiConsumer<T1,T2,E extends Exception>
Represents an operation that accepts two input arguments, returns no result and (optionally) throws an Exception. This is the two-arity specialization of Consumer. Unlike most other functional interfaces, BiConsumer is expected to operate via side effects.

This is a functional interface whose functional method is accept(Object, Object).

Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(T1 t, T2 t2)
    Applies this function to the given argument.
    default BiConsumer<T1,T2>
    Wraps this function that may throw an exception into a function that will throw a RuntimeException if the original function throws an exception.
    static <T1, T2> BiConsumer<T1,T2>
    unchecked(BiConsumer<? super T1,? super T2,?> function)
    Wraps a function that may throw an exception into a function that will throw a RuntimeException if the original function throws an exception.
  • Method Details

    • accept

      void accept(T1 t, T2 t2) throws E
      Applies this function to the given argument.
      Parameters:
      t - the first function argument
      t2 - the second function argument
      Throws:
      E - if an exception occurs
      Since:
      1.0
    • unchecked

      static <T1, T2> BiConsumer<T1,T2> unchecked(BiConsumer<? super T1,? super T2,?> function)
      Wraps a function that may throw an exception into a function that will throw a RuntimeException if the original function throws an exception.
      Type Parameters:
      T1 - the type of the first input to the function
      T2 - the type of the second input to the function
      Parameters:
      function - the function to wrap
      Returns:
      a function that will throw a RuntimeException if the original function throws an exception
      Since:
      1.0
    • unchecked

      default BiConsumer<T1,T2> unchecked()
      Wraps this function that may throw an exception into a function that will throw a RuntimeException if the original function throws an exception.
      Returns:
      a function that will throw a RuntimeException if the original function throws an exception
      Since:
      1.0
      See Also: