Package net.storm.api.commons
Interface PentaFunction<A,B,C,D,E,R>
- Type Parameters:
A- the type of the first argumentB- the type of the second argumentC- the type of the third argumentD- the type of the fourth argumentE- the type of the fifth argumentR- the type of the result
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a function that accepts five arguments and produces a result.
This is a functional interface extending the concept of Function
to support five input parameters. It is useful when you need to pass
multiple related values to a single computation.
Example usage:
// Define a function that calculates a weighted score
PentaFunction<Integer, Integer, Integer, Integer, Double, Double> weightedScore =
(a, b, c, d, weight) -> (a + b + c + d) * weight;
// Apply the function
double result = weightedScore.apply(10, 20, 30, 40, 0.5); // Returns 50.0
// Chain with another function
PentaFunction<Integer, Integer, Integer, Integer, Double, String> formatted =
weightedScore.andThen(score -> String.format("Score: %.2f", score));
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns a composed function that first applies this function to its input, and then applies theafterfunction to the result.Applies this function to the given arguments.
-
Method Details
-
apply
Applies this function to the given arguments.- Parameters:
a- the first function argumentb- the second function argumentc- the third function argumentd- the fourth function argumente- the fifth function argument- Returns:
- the function result
-
andThen
Returns a composed function that first applies this function to its input, and then applies theafterfunction to the result.If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
- Type Parameters:
K- the type of output of theafterfunction, and of the 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
afterfunction - Throws:
NullPointerException- ifafteris null
-