Class Functions


  • public final class Functions
    extends java.lang.Object
    Factory for Function.
    Since:
    3.14.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​R>
      R
      apply​(java.util.function.Function<T,​R> function, T object)
      Applies the Function on the object if the function is not null.
      static <T,​R>
      java.util.function.Function<T,​R>
      function​(java.util.function.Function<T,​R> function)
      Starts a fluent chain like function(foo::bar).andThen(...).andThen(...).apply(...);
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • apply

        public static <T,​R> R apply​(java.util.function.Function<T,​R> function,
                                          T object)
        Applies the Function on the object if the function is not null. Otherwise, does nothing and returns null.
        Type Parameters:
        T - the type of the argument the function applies.
        R - the type of the result the function returns.
        Parameters:
        function - the function to apply.
        object - the object to apply the function.
        Returns:
        the value the function returns if the function is not null; null otherwise.
        Since:
        3.15.0
      • function

        public static <T,​R> java.util.function.Function<T,​R> function​(java.util.function.Function<T,​R> function)
        Starts a fluent chain like function(foo::bar).andThen(...).andThen(...).apply(...);
        Type Parameters:
        T - Input type.
        R - Return type.
        Parameters:
        function - the argument to return.
        Returns:
        the argument