21 ms·
Because Java is a kingdom of nouns, and for the most part (method handles, which are just fancy reflection objects, aside), you can't name a function without cr
by quotemstr 9y ago
Because Java is a kingdom of nouns, and for the most part (method handles, which are just fancy reflection objects, aside), you can't name a function without creating a closure.
Anonymous callback:
Foo.foo(() -> bar());
Named callback:
private final class MyFooDelegate implements FooDelegate {
@Override
public void doFoo() {
bar();
}
}
...
Foo.foo(new MyFooDelegate())
- pjmlp 9y agoYou forgotten about method handles.
- deleted 9y ago[deleted]