3 ms·
> It's bad enough that passing a small fn (1 line of code in a decent language), requires a separate class and 20 lines of code in Java. No need to exaggerate,
by maweaver 16y ago
> It's bad enough that passing a small fn (1 line of code in a decent language), requires a separate class and 20 lines of code in Java.
No need to exaggerate, it's only a few extra lines
functionTakingCallback(new Callback() {
public void fn() {
...
}});
I agree it's verbose enough to be annoying, but hardly a deal-breaker imho.
EDIT: Just occurred to me that you might be looking at it from the other side, where you would have to define the callback class. Still, defining a static nested with a single function is only 3 lines of code.