Interface IntCharFunction<R>

  • Type Parameters:
    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 IntCharFunction<R>
    Function-Pointer Input: int, char Output: R.

    This is a 'Function' with the usual 'apply(...)' method, but actually accepts two primitive-type parameters as follows:

    1. 'int'
    2. 'char'


    The output of apply(...) is in accordance with the standard rules of Java's Generic-Type Functional-Interfaces - it may be specified via the Type-Parameter 'R'.


    • Method Summary

       
      @FunctionalInterface: (Lambda) Method
      Modifier and Type Method
      R apply​(int i, char c)
       
      Default Composition & Builder Method(s)
      Modifier and Type Method
      default <V> IntCharFunction<V> andThen​(Function<R,​V> after)
    • Method Detail

      • apply

        🡇     🗕  🗗  🗖
        R apply​(int i,
                char c)
        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:
        i - The integer (first) argument to the function.
        c - The char (second) argument to the function.
        Returns:
        The function result. Result shall be of type 'R'
      • andThen

        🡅     🗕  🗗  🗖
        default <V> IntCharFunction<V> andThen​
                    (java.util.function.Function<R,​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.
        Throws:
        java.lang.NullPointerException - This throws if null is passed to 'after'.
        Code:
        Exact Method Body:
         if (after == null) throw new NullPointerException
             ("null has been passed to parameter 'after'");
        
         return (int i, char c) -> after.apply(this.apply(i, c));