Is it possible to polymorphically pass a function to an object array in Java?
I’m trying to create an event-based system, and interfaces simply isn’t as versatile as I would like it to be.
As a result, I would like to be able to pass any function to the event manager, and have it execute the function on next iteration.
Wouldn’t we all. Unfortunately, Java doesn’t have first-class functions or even function pointers. So we’re stuck with interfaces and anonymous classes, until Java 8 at least.