4 ms·
Some examples here show the difference: https://stackoverflow.com/questions/4685563/how-to-pass-a-function-as-a-parameter-in-java https://stackoverflow.com/ques
by jayd16 5y ago
Some examples here show the difference:
https://stackoverflow.com/questions/4685563/how-to-pass-a-function-as-a-parameter-in-java https://stackoverflow.com/questions/4685563/how-to-pass-a-fu...
addCallback(new Callable<Integer>() {
public Integer call() {
return callback();
}
});
vs
addCallback(this::callback);
At least anonymous types meant you didn't have to manually name all your listener boilerplate.
- mcculley 5y agoAh. Yeah, this would have made callbacks simpler in the case where there is only one method. I was thinking about JavaBeans EventObject/EventListener usage, which is so tedious, but enables introspection by tools.