I am a newbie in Java. I want to create a method, that takes the first parameter as Function and the second parameter as a List of Objects as follows:
public void dynamicMethodExecution(Somefunction someFunction, List<T> params) {
//Pass the params to the someFunction and execute the someFunction.
}
If I pass any function and any list of parameters to 'dynamicMethodExecution', then it should execute the function by passing the parameters.
This method 'dynamicMethodExecution' should be as generic as possible, i.e. it should take any kind of function and execute it on the fly.
Any idea, how can I do this?