There's a feature of the Apple Objective-C language which is really useful to me: I can pass code blocks as argument in methods.
I'd like to do that in Java, too. Something like:
myManager.doSomethingInTransaction(function() {
dao.save();
});
So the myManager object will execute my code between a startTransaction() and a endTransaction() methods.
Is there a way to get that in Java?