Interface CheckedConsumer<T>

Type Parameters:
T - the type of the input to the operation
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@NullMarked @FunctionalInterface public interface CheckedConsumer<T>
A functional interface representing an operation that accepts a single input argument, returns no result, and may throw a checked exception. This is a variation of the standard Consumer interface, intended for use in scenarios where the operation may involve checked exceptions.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(T t)
    Performs this operation on the given argument, potentially throwing a checked exception.
  • Method Details

    • accept

      void accept(T t) throws Exception
      Performs this operation on the given argument, potentially throwing a checked exception.
      Parameters:
      t - the input argument
      Throws:
      Exception - if an error occurs during the operation