Class LazyUnaryOperator<T>

  • Type Parameters:
    T - the result type
    All Implemented Interfaces:
    Serializable, Function<T,​T>, UnaryOperator<T>

    public final class LazyUnaryOperator<T>
    extends Object
    implements UnaryOperator<T>, Serializable
    Like the LazyFunction the LazyUnaryOperator can be used when the function Argument and Return Type are same. LazyUnaryOperator is intended to be memorized and idempotent for every parameter. This can be very useful for operations with high latency whose result are used multitudinous. .The result of every function operation are store and retrieves if the same parameter is passed instead of computing again. Every operation is performed once with unique parameters and the result and served whenever needed.
    Since:
    1.0
    Author:
    , Bobai Kato
    See Also:
    Function, LazyFunction, Serialized Form
    • Method Detail

      • of

        @Contract("_ -> new")
        @NotNull
        public static <T> @NotNull UnaryOperator<T> of​(UnaryOperator<T> operator)
        Take the operator argument of of UnaryOperator type.
        Type Parameters:
        T - the type parameter
        Parameters:
        operator - the function, of UnaryOperator type
        Returns:
        the function, an instance of Function type.
      • apply

        public 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        @Contract(value="null -> false",
                  pure=true)
        public boolean equals​(Object o)
        Overrides:
        equals in class Object