Interface ThrowingConsumer<T>

  • Type Parameters:
    T - the type of the input to the operation
    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>
    This interface replaces Consumer in cases when execution of accept(Object) method may throw exception.

    Useful for capturing lambdas that throw exceptions.

    • Method Detail

      • accept

        void accept​(T t)
             throws java.lang.Throwable
        Performs this operation on the given argument.
        Parameters:
        t - input argument
        Throws:
        java.lang.Throwable - exception that may be thrown