Interface ThrowingConsumer<T,X extends Throwable>

Type Parameters:
T - the type of the input to the operation
X - the type of the exception thrown by the function
All Superinterfaces:
Consumer<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 ThrowingConsumer<T,X extends Throwable> extends Consumer<T>
An extension of Consumer allowing throwing calls in its body.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    accept(T t)
     
    void
    Performs this operation on the given argument.

    Methods inherited from interface java.util.function.Consumer

    andThen
  • Method Details

    • acceptChecked

      void acceptChecked(T t) throws X
      Performs this operation on the given argument.
      Parameters:
      t - the input argument
      Throws:
      X - if an exception happens
    • accept

      default void accept(T t)
      Specified by:
      accept in interface Consumer<T>