Interface ThrowingConsumer<T>

Type Parameters:
T - the type of the input to the consumer.
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> extends Consumer<T>
A subclass of Consumer that allows for thrown exceptions.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    accept(T t)
     
    void
    The functional method to implement.

    Methods inherited from interface java.util.function.Consumer

    andThen
  • Method Details

    • accept

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

      void acceptThrows(T t) throws Exception
      The functional method to implement.
      Parameters:
      t - The type of the input to the consumer.
      Throws:
      Exception - Any exception.