Interface UnaryOperator<T>

Type Parameters:
T - the operating type
All Superinterfaces:
Function<T,T>, Function<T,T>, UnaryOperator<T>
All Known Implementing Classes:
UnaryOperator.IdentityOperator

public interface UnaryOperator<T> extends UnaryOperator<T>, Function<T,T>
An enhanced unary operator.
Author:
Paul Ferraro
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
     

    Nested classes/interfaces inherited from interface org.wildfly.clustering.function.Function

    Function.IdentityFunction<T extends R,R>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final UnaryOperator<?>
     
    static final UnaryOperator<?>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default UnaryOperator<T>
    andThen(UnaryOperator<T> operator)
    Returns an operator that applies the specified operator to the result of this operator.
    default UnaryOperator<T>
    compose(UnaryOperator<T> operator)
    Returns an operator that applies this operator to the result of the specified operator.
    static <T> UnaryOperator<T>
    Returns an operator that returns its value.
    static <T> UnaryOperator<T>
    of(Function<? super T,T> function)
    Returns an operator view of the specified function.
    static <T> UnaryOperator<T>
    of(Supplier<T> supplier)
    Returns an operator that returns the result of the specified supplier, ignoring its parameter.
    static <T> UnaryOperator<T>
    of(T value)
    Returns an operator that always returns the specified value, ignoring its parameter.
    default UnaryOperator<T>
    orDefault(Predicate<T> predicate, Supplier<T> defaultResult)
    Returns an operator that applies this function to the value returned by the specified provider if its value does not match the specified predicate.
    default UnaryOperator<T>
    withDefault(Predicate<T> predicate, Supplier<T> defaultValue)
    Returns an operator that applies this function if its parameter matches the specified predicate, or returns the value provided by the specified supplier otherwise.

    Methods inherited from interface java.util.function.Function

    apply

    Methods inherited from interface org.wildfly.clustering.function.Function

    andThen, compose
  • Field Details

  • Method Details

    • orDefault

      default UnaryOperator<T> orDefault(Predicate<T> predicate, Supplier<T> defaultResult)
      Returns an operator that applies this function to the value returned by the specified provider if its value does not match the specified predicate.
      Specified by:
      orDefault in interface Function<T,T>
      Parameters:
      predicate - a predicate used to determine the parameter of this function
      defaultResult - a provider of the default parameter value
      defaultValue - a provider of the default parameter value
      Returns:
      an operator that applies this function to the value returned by the specified provider if its value does not match the specified predicate.
    • withDefault

      default UnaryOperator<T> withDefault(Predicate<T> predicate, Supplier<T> defaultValue)
      Returns an operator that applies this function if its parameter matches the specified predicate, or returns the value provided by the specified supplier otherwise.
      Specified by:
      withDefault in interface Function<T,T>
      Parameters:
      predicate - a predicate used to determine the parameter of this function
      defaultValue - a provider of the default parameter value
      defaultResult - a provider of the default parameter value
      Returns:
      an operator that applies this function if its parameter matches the specified predicate, or returns the value provided by the specified supplier otherwise.
    • andThen

      default UnaryOperator<T> andThen(UnaryOperator<T> operator)
      Returns an operator that applies the specified operator to the result of this operator.
      Parameters:
      operator - an operator to apply to the result of this operation
      Returns:
      an operator that applies the specified operator to the result of this operator.
    • compose

      default UnaryOperator<T> compose(UnaryOperator<T> operator)
      Returns an operator that applies this operator to the result of the specified operator.
      Parameters:
      operator - an operator to apply to the result of this operation
      Returns:
      an operator that applies this operator to the result of the specified operator.
    • identity

      static <T> UnaryOperator<T> identity()
      Returns an operator that returns its value.
      Type Parameters:
      T - the operating type
      Returns:
      an operator that returns its value.
    • of

      static <T> UnaryOperator<T> of(T value)
      Returns an operator that always returns the specified value, ignoring its parameter.
      Type Parameters:
      T - the operating type
      Parameters:
      value - the value returned by the operator
      Returns:
      an operator that always returns the specified value, ignoring its parameter.
    • of

      static <T> UnaryOperator<T> of(Supplier<T> supplier)
      Returns an operator that returns the result of the specified supplier, ignoring its parameter.
      Type Parameters:
      T - the operating type
      Parameters:
      supplier - the supplier of the operator result
      Returns:
      an operator that returns the result of the specified supplier, ignoring its parameter.
    • of

      static <T> UnaryOperator<T> of(Function<? super T,T> function)
      Returns an operator view of the specified function.
      Type Parameters:
      T - the operating type
      Parameters:
      function - the delegating function
      Returns:
      an operator view of the specified function.