Interface XBiConsumer<T,U>

Type Parameters:
T - 第一个参数的类型
U - 第二个参数的类型
All Superinterfaces:
BiConsumer<T,U>, Serializable
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 XBiConsumer<T,U> extends BiConsumer<T,U>, Serializable
表示接受两个输入参数且不返回结果的操作
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    accept(T t, U u)
    对给定参数执行此操作
    void
    accepting(T t, U u)
    对给定参数执行此操作
    default XBiConsumer<T,U>
    andThen(XBiConsumer<? super T,? super U> after)
    返回一个组合的XBiConsumer,它依次执行该操作和after操作 如果执行任一操作引发异常,则将其传递给组合操作的调用方 如果执行此操作引发异常,则不会执行after操作
    static <T, U> XBiConsumer<T,U>
    multi(XBiConsumer<T,U>... consumers)
    multi
    static <T, U> XBiConsumer<T,U>
    什么也不做,用于一些需要传入lambda的方法占位使用

    Methods inherited from interface java.util.function.BiConsumer

    andThen
  • Method Details

    • multi

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

      static <T, U> XBiConsumer<T,U> nothing()
      什么也不做,用于一些需要传入lambda的方法占位使用
      Type Parameters:
      T - 参数1类型
      U - 参数2类型
      Returns:
      什么也不做
    • accepting

      void accepting(T t, U u) throws Exception
      对给定参数执行此操作
      Parameters:
      t - 第一个输入参数
      u - 第二个输入参数
      Throws:
      Exception - 包装检查异常,方便使用
    • accept

      default void accept(T t, U u)
      对给定参数执行此操作
      Specified by:
      accept in interface BiConsumer<T,U>
      Parameters:
      t - 第一个输入参数
      u - 第二个输入参数
    • andThen

      default XBiConsumer<T,U> andThen(XBiConsumer<? super T,? super U> after)
      返回一个组合的XBiConsumer,它依次执行该操作和after操作 如果执行任一操作引发异常,则将其传递给组合操作的调用方 如果执行此操作引发异常,则不会执行after操作
      Parameters:
      after - 执行该操作后需要执行的操作
      Returns:
      一个组合的XBiConsumer,它按顺序执行此操作,然后执行after操作
      Throws:
      NullPointerException - 如果after为空