Re:Generics facilitators in Go
by mcculley on Wednesday December 22, 2021 @03:19PM
(#29654531)
I don’t think I understand what you mean. What would have been different about listener interfaces if lambdas and method references had been available?
[ Parent
| on HN ]
Some examples here show the difference:
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.Ah. 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.