Interface ExceptionConsumer<T,E extends Exception>

Type Parameters:
T - the argument type
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 ExceptionConsumer<T,E extends Exception>
A one-argument consumer which can throw an exception.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(T t)
    Performs this operation on the given argument.
    andThen(ExceptionConsumer<? super T,? extends E> after)
    Returns a consumer which passes the argument to this consumer followed by the given consumer.
    compose(ExceptionConsumer<? super T,? extends E> before)
    Returns a consumer which passes the argument to the given consumer followed by this consumer.
    compose(ExceptionSupplier<? extends T,? extends E> before)
    Returns a runnable which passes the result of the given supplier to this consumer.
  • Method Details

    • accept

      void accept(T t) throws E
      Performs this operation on the given argument.
      Parameters:
      t - the argument
      Throws:
      E - if an exception occurs
    • andThen

      default ExceptionConsumer<T,E> andThen(ExceptionConsumer<? super T,? extends E> after)
      Returns a consumer which passes the argument to this consumer followed by the given consumer.
      Parameters:
      after - the next consumer (must not be null)
      Returns:
      a consumer which passes the argument to this consumer followed by the given consumer
    • compose

      default ExceptionConsumer<T,E> compose(ExceptionConsumer<? super T,? extends E> before)
      Returns a consumer which passes the argument to the given consumer followed by this consumer.
      Parameters:
      before - the first consumer (must not be null)
      Returns:
      a consumer which passes the argument to the given consumer followed by this consumer
    • compose

      default ExceptionRunnable<E> compose(ExceptionSupplier<? extends T,? extends E> before)
      Returns a runnable which passes the result of the given supplier to this consumer.
      Parameters:
      before - the suppler (must not be null)
      Returns:
      a runnable which passes the result of the given supplier to this consumer