I want to receive a function in parameter and call it with one parameter as:
public static <T> T foo(Callable<T> func)
{
return func.call("bar");
}
But it call doesn't take any parameter. Any idea on how can I do this?
No matter how much I search, I dont find anything that help me...
A
Callable<T>only has one method:T call().If you want something different, you will need to use a different parameter type, for example:
Then your function can do: