Class BiFunctionSupport


  • public final class BiFunctionSupport
    extends Object
    Helper class for constructing BiFunctions in a Spring-friendly manner.
    Since:
    8.1.0
    • Constructor Detail

      • BiFunctionSupport

        private BiFunctionSupport()
        Constructor.
    • Method Detail

      • constant

        @Nonnull
        public static <T,​U,​V> BiFunction<T,​U,​V> constant​(@Nonnull @ParameterName(name="target")
                                                                                 V target)
        Creates a BiFunction that returns a constant value.
        Type Parameters:
        T - type of object the function needs to act on
        U - type of object the function needs to act on
        V - type of object being returned
        Parameters:
        target - the value to return from the function
        Returns:
        the constructed function
      • forFunctionOfFirstArg

        @Nonnull
        public static <A,​B,​C> BiFunction<A,​B,​C> forFunctionOfFirstArg​(@Nonnull @ParameterName(name="function")
                                                                                              Function<? super A,​? extends C> function)
        Adapts a Function into a {BiFunction} that ignores the second argument.
        Type Parameters:
        A - input type of function
        B - ignored argument type
        C - return type
        Parameters:
        function - the function to apply
        Returns:
        the adapted object
        Since:
        8.3.0
      • forFunctionOfSecondArg

        @Nonnull
        public static <A,​B,​C> BiFunction<A,​B,​C> forFunctionOfSecondArg​(@Nonnull @ParameterName(name="function")
                                                                                               Function<? super B,​? extends C> function)
        Adapts a Function into a {BiFunction} that ignores the first argument.
        Type Parameters:
        A - ignored argument type
        B - input type of function
        C - return type
        Parameters:
        function - the function to apply
        Returns:
        the adapted object
        Since:
        8.3.0