Interface ThrowingConsumer<T>

  • Type Parameters:
    T - consumed type
    All Superinterfaces:
    java.util.function.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 java.util.function.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 Detail

      • accept

        default void accept​(T input)
        Specified by:
        accept in interface java.util.function.Consumer<T>
      • acceptThrows

        void acceptThrows​(T input)
                   throws java.lang.Throwable
        Throws:
        java.lang.Throwable