Interface ThrowingConsumer<T>

Type Parameters:
T - consumed type
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>
Consumer that deals with checked exceptions by rethrowing them as RuntimeException.

More precisely, RuntimeException and AssertionError are rethrown as they are while any other Throwable are rethrown as RuntimeException.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    accept(T input)
     
    void
    acceptThrows(T input)
     

    Methods inherited from interface java.util.function.Consumer

    andThen
  • Method Details