Interface XFunction<T,R>

Type Parameters:
T - 函数的输入类型
R - 函数结果的类型
All Superinterfaces:
Function<T,R>, 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 XFunction<T,R> extends Function<T,R>, Serializable
表示接受一个参数并产生结果的函数
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    default R
    apply(T t)
    将此函数应用于给定的参数
    将此函数应用于给定的参数
    static <T, R> Function<T,R>
    执行函数
    static <T> XFunction<T,T>
    返回一个始终返回其输入参数的函数

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Method Details

    • identity

      static <T> XFunction<T,T> identity()
      返回一个始终返回其输入参数的函数
      Type Parameters:
      T - 函数的输入和输出对象的类型
      Returns:
      始终返回其输入参数的函数
    • castingIdentity

      static <T, R> Function<T,R> castingIdentity()
      执行函数
      Type Parameters:
      T - 函数的输入类型
      R - 函数结果的类型
      Returns:
      执行后的结果
    • applying

      R applying(T t) throws Exception
      将此函数应用于给定的参数
      Parameters:
      t - 函数参数
      Returns:
      函数结果
      Throws:
      Exception - 包装的检查异常
    • apply

      default R apply(T t)
      将此函数应用于给定的参数
      Specified by:
      apply in interface Function<T,R>
      Parameters:
      t - 函数参数
      Returns:
      函数结果