Interface BooleanTFunction<T,​R>

  • Type Parameters:
    T - The type of the second 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 BooleanTFunction<T,​R>
    Function-Pointer Input: boolean, 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 'boolean' and one of generic parameter-type 'T'


    • Method Summary

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

      • apply

        🡇    
        R apply​(boolean b,
                T t)
        Applies this function to the given arguments.
        Parameters:
        b - The boolean (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> BooleanTFunction<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 (boolean b, T t) -> after.apply(this.apply(b, t));