Package Torello.Java.Function
Interface QuintFunction<A,B,C,D,E,R>
-
- Type Parameters:
A
- The type of the first input-parameter.B
- The type of the second input-parameter.C
- The type of the third input-parameter.D
- The type of the fourth input-parameter.E
- The type of the last input-parameter.R
- The type of the function-output.
public interface QuintFunction<A,B,C,D,E,R>
Function-Pointer Input:A, B, C, D, E
Output:R
.
This is an extension of Java's original functional-interfaces package. ThisFunctional Interface
designed here creates a "Quint Function" - a straight-forward extension ofinterface java.util.function.Function
- but instead has an'apply(...)'
method receiving five variable-type parameters instead of just one.
NOTE: Java's Basic Packagejava.util.function.*
, contains aninterface
namedBiFunction
, that extends the basicFunction<T>
tointerface BiFunction<T, U>
. Theinterface
that is implemented here follows a similar vein, but extends the number of generic type-parameters to five, instead of two.
ALSO: Here, the number of return type-parameters (obviously) is still just one - since only one return value is possible, in Java.
Hi-Lited Source-Code:- View Here: Torello/Java/Function/QuintFunction.java
- Open New Browser-Tab: Torello/Java/Function/QuintFunction.java
File Size: 1,917 Bytes Line Count: 51 '\n' Characters Found
-
-
Method Detail
-
apply
R apply(A a, B b, C c, D d, E e)
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:
a
- the first input argumentb
- the second input argumentc
- the third input argumentd
- the fourth input argumente
- the fifth input argument- Returns:
- The result of the function. Return result is of type
'R'
-
andThen
default <V> QuintFunction<A,B,C,D,E,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.- Parameters:
after
- The function to apply after'this'
function is applied. This must be a simple, or single-argument function that has a variable-type parameter'X'
- or rather, the same-type as the output-type of'this'
(which, again, is'X'
- and pleaselook at the top of this page to see that'X'
is, indeed, the output type of'this' apply(...)
method).
NOTE: The composed function that is returned will, itself, have anapply(...)
method with variable-parameter return type'V'
.- Returns:
- a composed
'QuintFunction'
, that first applies'this'
function, and then applies the'after'
function. - Throws:
java.lang.NullPointerException
- This is thrown if'after'
is null.- Code:
- Exact Method Body:
if (after == null) throw new NullPointerException("parameter 'after' has been passed null."); return (A a, B b, C c, D d, E e) -> after.apply(this.apply(a, b, c, d, e));
-
-