Interface ThrowingConsumer<A,T extends Throwable>

Type Parameters:
A - The input argument type to be consumed
T - The type of Throwable thrown by the consumer
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<A,T extends Throwable>
A better version of Java's Consumer interface that allows for the consumers to throw whatever Throwable is specified.
Version:
0.1-Alpha-SNAPSHOT
Author:
Logan Ferree (Tadukoo)
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(A a)
    Takes a single argument and consumes it.
    andThen(ThrowingConsumer<? super A,? extends T> after)
    Creates a ThrowingConsumer that runs this ThrowingConsumer and then also runs the given ThrowingConsumer on the same argument.
  • Method Details

    • accept

      void accept(A a) throws T
      Takes a single argument and consumes it.
      Parameters:
      a - The argument
      Throws:
      T - Determined by the consumer, not required
    • andThen

      default ThrowingConsumer<A,T> andThen(ThrowingConsumer<? super A,? extends T> after)
      Creates a ThrowingConsumer that runs this ThrowingConsumer and then also runs the given ThrowingConsumer on the same argument.
      Parameters:
      after - A 2nd ThrowingConsumer to run the argument on after this one
      Returns:
      The ThrowingConsumer made from composing this one and the given one