Interface XUnaryOperator<T>

All Superinterfaces:
Function<T,T>, Serializable, UnaryOperator<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 XUnaryOperator<T> extends UnaryOperator<T>, Serializable
表示对单个操作数的操作,该操作产生与其操作数相同类型的结果 对于操作数和结果类型相同的情况,这是 Function 的一种特殊化
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    apply(T t)
    将此函数应用于给定的参数
    将此函数应用于给定的参数
    static <T, R, F extends Function<T, R>>
    XUnaryOperator<T>
    casting(F function)
    执行函数操作
    static <T> XUnaryOperator<T>
    返回始终返回其输入参数的一元运算符

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Method Details

    • identity

      static <T> XUnaryOperator<T> identity()
      返回始终返回其输入参数的一元运算符
      Type Parameters:
      T - 输入输出类型
      Returns:
      始终返回其输入参数的一元运算符
    • casting

      static <T, R, F extends Function<T, R>> XUnaryOperator<T> casting(F function)
      执行函数操作
      Type Parameters:
      T - 参数类型
      R - 结果类型
      F - 函数类型
      Parameters:
      function - 源函数
      Returns:
      函数结果
    • applying

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

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