Interface ConsumerX<T>

Type Parameters:
T - 参数类型
All Superinterfaces:
Consumer<T>, Serializable
All Known Implementing Classes:
FileTailer.ConsoleLineHandler
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 ConsumerX<T> extends Consumer<T>, Serializable
可序列化的Consumer
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    accept(T t)
    Performs this operation on the given argument.
    void
    Performs this operation on the given argument.
    default ConsumerX<T>
    andThen(ConsumerX<? super T> after)
    Returns a composed Consumer that performs, in sequence, this operation followed by the after operation.
    static <T> ConsumerX<T>
    multi(ConsumerX<T>... consumers)
    multi
    static <T> ConsumerX<T>
    nothing

    Methods inherited from interface java.util.function.Consumer

    andThen
  • Method Details

    • multi

      @SafeVarargs static <T> ConsumerX<T> multi(ConsumerX<T>... consumers)
      multi
      Type Parameters:
      T - type
      Parameters:
      consumers - lambda
      Returns:
      lambda
    • nothing

      static <T> ConsumerX<T> nothing()
      nothing
      Type Parameters:
      T - type
      Returns:
      nothing
    • accepting

      void accepting(T t) throws Throwable
      Performs this operation on the given argument.
      Parameters:
      t - the input argument
      Throws:
      Exception - wrapped checked exception
      Throwable
    • accept

      default void accept(T t)
      Performs this operation on the given argument.
      Specified by:
      accept in interface Consumer<T>
      Parameters:
      t - the input argument
    • andThen

      default ConsumerX<T> andThen(ConsumerX<? super T> after)
      Returns a composed Consumer that performs, in sequence, this operation followed by the after operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the after operation will not be performed.
      Parameters:
      after - the operation to perform after this operation
      Returns:
      a composed Consumer that performs in sequence this operation followed by the after operation
      Throws:
      NullPointerException - if after is null