How can you count the number of parameters while initializing a variadic function/lambda expression? Or: how can you determine the arity of a lambda-expression?
Example:
public class MathFunction{
private java.util.function.Function <double[], Double> function = null;
private int length = 0;
public MathFunction ( Function <double[], Double> pFunction ){
this.function = pFunction;
this.length = ???
}
}
Now, if you init a new MathFunction
like this,
MathFunction func = new MathFunction((x) -> Math.pow(x[0], x[1]));
how can you count the passed parameters (here: two) in the MathFunction
-constructor ?