Interface FailableConsumer<T,​E extends Exception>

  • Type Parameters:
    T - The type of the data being consumed
    E - The exception type
    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 FailableConsumer<T,​E extends Exception>
    A consumer that may fail with a checked exception during the execution of the accept(..) method.
    Author:
    Eyal Schneider
    • Method Detail

      • accept

        void accept​(T t)
             throws E extends Exception
        Performs this operation on the given argument.
        Parameters:
        t - the input argument
        Throws:
        E extends Exception
      • fromConsumer

        static <T,​E extends ExceptionFailableConsumer<T,​E> fromConsumer​(Consumer<T> consumer)
        Utility method for wrapping a consumer with a failable consumer
        Parameters:
        consumer - The consumer to wrap
        Returns:
        The failable consumer (which effectively never throws checked exceptions)