Does anybody know, if closures will be in Java 7?
It is unknown until the Java SE 7 JSR is created (presumably by Danny Coward) and an expert group is formed and the contents selected.
My Java 7 page is a good collection of links about Java 7 in general and has links to all of the closures proposals and blog entries:
http://tech.puredanger.com/java7#closures
And I maintain a Java 7 link blog where you can find links on closures and other stuff at:
And you might find my Java 7 Predictions blog post to be interesting as well if you want my opinions: http://tech.puredanger.com/2008/08/02/java7-prediction-update/
UPDATE: Mark Reinhold stated at Devoxx in Dec. 08 that closures will NOT be included in Java 7 due to a lack of consensus on how to implement.
There are currently several competing proposals, BGGA, CICE, among others. Unfortunately, a heated debate remains over the best approach. As a result it is unlikely at this point that closures will make it into Java 7, due to the conservative nature of the acceptance process.
The key problem here is that it can be very difficult to add features to a pre-existing language, without inadvertently introducing significant complexity. This was the experience with Generics in Java 1.5, and many are concerned that it would be compounded with the introduction of closures.
My advice is that if you really want to have access to modern language features like closures, but wish to stay within the Java ecosysteym, you should take a look at Scala.
Groovy is the best Java alternative I've seen that includes features of dynamic languages including closures, run-time class extension, etc. While Ruby has a slight design advantage imho, I'd have to say the fact that Groovy compiles into Java byte-code and interacts with Java without ANY interface code is a huge plus that can't be ignored.
Closure won't definitively be present in Java 7, but if you are looking for a lighter solution to have closure in java right now check out how they have been implemented in the lambdaj library:
I have just read a report that says that closures will be in Java 7, can anyone confirm or deny this?
Thanks
Closures will be included in Java 7. Mark Reinhold announced this reversal at Devoxx 2009.