Closures in Java 7.0
by Krishna Srinivasan
An excerpt from sun blogs:
Java 7.0 (Dolphin) Resources and New features (Closures)
|Let's keep Java fun and simple and stop cluttering it with garbage.|
Closures possess the power to either bring another elegant feature to the Java language OR to make the language hard to understand and unreadable.
|I rather like the idea of closures for use as callbacks. Sometimes we need to send messages that don't make sense to model as events.|
|Way too late. Why isn't this is Java 6?|
All dynamic languages had these for ages...
What I see is that Java started to adopt ideas which
was "rejected" at the begining, to preserve the language simple.
But as we saw Iterators and now Closures java will loose its
"simplicity" (i.e. overdesign ;) ).
In my opinion, I welcome the changes but they are too late ;(.
From the java-purist standpoint it is not good ;).
I have been either "rolling my own" or using the predicates and closures in apache commons collections package with a lot of success.... almost all of my custom domain collections contain a method like void forAll(Closure foo) that I do stuff like:
|Is This the same concept as C# delegates or C++ functors?|