Interface UnaryOperatorX<T>

Type Parameters:
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 UnaryOperatorX<T> extends UnaryOperator<T>, Serializable
可序列化的UnaryOperator
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    apply(T t)
    Applies this function to the given argument.
    Applies this function to the given argument.
    static <T, R, F extends Function<T, R>>
    UnaryOperatorX<T>
    casting(F function)
    casting identity
    static <T> UnaryOperatorX<T>
    Returns a unary operator that always returns its input argument.

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Method Details

    • identity

      static <T> UnaryOperatorX<T> identity()
      Returns a unary operator that always returns its input argument.
      Type Parameters:
      T - the type of the input and output of the operator
      Returns:
      a unary operator that always returns its input argument
    • casting

      static <T, R, F extends Function<T, R>> UnaryOperatorX<T> casting(F function)
      casting identity
      Type Parameters:
      T - param type
      R - result type
      F - lambda type
      Parameters:
      function - source function
      Returns:
      identity after casting
    • applying

      T applying(T t) throws Throwable
      Applies this function to the given argument.
      Parameters:
      t - the function argument
      Returns:
      the function result
      Throws:
      Exception - wrapped checked exception
      Throwable
    • apply

      default T apply(T t)
      Applies this function to the given argument.
      Specified by:
      apply in interface Function<T,T>
      Parameters:
      t - the function argument
      Returns:
      the function result