R - the type of the result of the function@FunctionalInterface public interface FunctionN<R> extends ResultChainableResult<R>, Arity
n arguments and produces a result.
All functions are derived from this n-arity specialization.
This is a functional interface whose functional method is applyAllUnchecked(Object...).
| Modifier and Type | Interface and Description |
|---|---|
static class |
FunctionN.FunctionSizeException
A
RuntimeException that is thrown whenever the size of
the arguments of a function is not equal to its arity. |
static class |
FunctionN.Instance<R>
An instance of
FunctionN which properly defines the
arity of that particular function. |
| Modifier and Type | Method and Description |
|---|---|
default <V> FunctionN<V> |
andThen(Function1<? super R,? extends V> after)
Returns a chained object that applies this chainable object, and then
applies the
after function to ths result. |
default <V> FunctionN<V> |
andThenUnchecked(Function1<? super R,? extends V> after)
Returns a chained object that applies this chainable object, and then
applies the
after function to ths result. |
R |
applyAllUnchecked(java.lang.Object... args)
Applies this function to the given arguments.
|
default int |
arity()
Returns the number of arguments of the function.
|
static <T> T[] |
checkSize(int size,
T[] array)
Checks the size of the
array to see if it is equal to
the expected size. |
static <T> T[] |
checkSize(int size,
T[] array,
java.lang.String message)
Checks the size of the
array to see if it is equal to
the expected size. |
default R |
sizedApplyAllUnchecked(java.lang.Object... args)
Applies this function to the given arguments.
|
R applyAllUnchecked(java.lang.Object... args)
args - the function argumentsdefault int arity()
-1.default R sizedApplyAllUnchecked(java.lang.Object... args)
arity() of this function,
an exception will be thrown.args - the number of arguments of the functionFunctionN.FunctionSizeException - if the number of arguments of the
function is not equal to its aritydefault <V> FunctionN<V> andThen(Function1<? super R,? extends V> after)
ResultChainableafter function to ths result. If evaluation of either
throws an exception, it is relayed to the caller of the chained object.andThen in interface ResultChainable<R>andThen in interface ResultChainableResult<R>V - the type of the output of the after function, and of
the chained objectafter - the function to apply after this chainable object is appliedafter functiondefault <V> FunctionN<V> andThenUnchecked(Function1<? super R,? extends V> after)
ResultChainableafter function to ths result. If evaluation of either
throws an exception, it is relayed to the caller of the chained object.
This makes no assumptions on the arguments of this method.andThenUnchecked in interface ResultChainable<R>andThenUnchecked in interface ResultChainableResult<R>V - the type of the output of the after function, and of
the chained objectafter - the function to apply after this chainable object is appliedafter functionstatic <T> T[] checkSize(int size,
T[] array)
array to see if it is equal to
the expected size. If not, an exception is thrown.T - the type of the elements in the arraysize - the expected size of the arrayarray - the array being checkedFunctionN.FunctionSizeException - if the array's length and the expected
size are not equalstatic <T> T[] checkSize(int size,
T[] array,
java.lang.String message)
array to see if it is equal to
the expected size. If not, an exception is thrown.T - the type of the elements in the arraysize - the expected size of the arrayarray - the array being checkedmessage - the error message shown if the array's length and
the expected size are not equalFunctionN.FunctionSizeException - if the array's length and the expected
size are not equal