3/7 Is there a simple way to use/pass function pointers in Java?
I know I can emulate this by using interfaces or defining
a base class with a function foo, and subclasses which
override foo and passing instances of those classes, but that
is ugly. I'd like something simple like the LISP, C/C++, Python,
or Tcl method of passing a function. Thanks.
\_ This isn't syntatically pretty either, but anonymous inner
classes might be what you are looking for.
\_ You might be able to do something like this reflection.
For a simple example take a look at /tmp/InvokeExample.java.
\_ Wrap it up in an anonymous inner class. Anonymous inner classes
are (modulo some tweaks) semantically equivelent to typed lambdas
\_ lambdas! |