3 ms·
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?
by mcculley 5y ago
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?
- jayd16 5y agoSome 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.