Interface IThrowingFunction<T,​R>

    • Method Detail

      • of

        static <T,​R> IThrowingFunction<T,​R> of​(IThrowingFunction<T,​R> fn)
        Returns the given supplier, for improved variable inference. Sometimes you need to create local variables and assign them to a new lambda. This does not work well with variable inference, as Java cannot infer the type of an anonymous lambda. This utility method lets you write slightly more readable code like this:
         final var fn = ISerializableThrowingFunction.of(t -> ...);
        
         
        Type Parameters:
        T - the type of the argument expected by the function
        R - the type of the result of the function
        Parameters:
        fn - Function to return.
        Returns:
        The given supplier.
      • throwingFunction

        static <T,​R> IThrowingFunction<T,​R> throwingFunction​(IThrowingFunction<T,​R> fn)
        Returns the given function, for improved variable inference. Sometimes you need to create local variables and assign them to a new lambda. This does not work well with variable inference, as Java cannot infer the type of an anonymous lambda. This utility method lets you write slightly more readable code like this:
         final var fn = throwingFunction(t -> ...);
        
         
        Type Parameters:
        T - the type of the argument expected by the function
        R - the type of the result of the function
        Parameters:
        fn - Function to return.
        Returns:
        The given supplier.