Interface ShortTFunction<T,​R>

  • Type Parameters:
    T - The type of the second (last) input-parameter.
    R - The type of the function-output.
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ShortTFunction<T,​R>
    Function-Pointer Input: short, T Output: R.

    A Functional Interface, that's similar to java.util.function.BiFunction, but having an apply(...) method that accepts a parameter of primitive-type 'short' and a parameter of Parameterized-Type 'T'


    • Method Summary

       
      @FunctionalInterface: (Lambda) Method
      Modifier and Type Method
      R apply​(short s, T t)
       
      Default Composition & Builder Method(s)
      Modifier and Type Method
      default <V> ShortTFunction<T,​V> andThen​(Function<? super R,​? extends V> after)
    • Method Detail

      • apply

        🡇     🗕  🗗  🗖
        R apply​(short s,
                T t)
        Applies this function to the given arguments.

        FunctionalInterface Target-Method:
        This method corresponds to the @FunctionalInterface Annotation's method requirement. It is the only non-default, non-static method in this interface, and may be the target of a Lambda-Expression or '::' (double-colon) Function-Pointer.
        Parameters:
        s - The short (first) argument to the function.
        t - The (second) argument to the function.
        Returns:
        The function result. Result shall be of type 'R'
      • andThen

        🡅     🗕  🗗  🗖
        default <V> ShortTFunction<T,​V> andThen​
                    (java.util.function.Function<? super R,​? extends V> after)
        
        Returns a composed function that first applies 'this' function to its input, and then applies the 'after' function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
        Type Parameters:
        V - the output-type of the 'after' function, and also of the (returned) 'composed' function.
        Parameters:
        after - The function to apply, after this function is applied.
        Returns:
        a composed function that first applies 'this' function and then applies the 'after' function
        Throws:
        java.lang.NullPointerException - if null is passed to parameter 'after'.
        Code:
        Exact Method Body:
         if (after == null) throw new NullPointerException
             ("null has been passed to parameter 'after'");
        
         return (short s, T t) -> after.apply(this.apply(s, t));