Well after the comments, here is the answer: There is no simple and convenient way to pass a function.
In most cases, you declare an inner class that implements the interface, for example, Comparator : http://docs.oracle.com/javase/6/docs/api/java/util/Comparator.html
The fact that functions cannot be passed as parameters has caused a lot of so-called design patterns, where you go through object classes / interfaces that declare the presence of these functions.
As others have mentioned, life will be a little easier with Java 8.
source share