Closures in Java?

There has been discussion about including closures in Java for a few years now. They are already in languages like Groovy, Ruby and Scala, so the lack of Java closures makes Java look a bit tired. However, I didn’t realize that there are some Apache Commons classes that allow you to make limited use of closures. To implement closures without proper language support, the Apache Commons Collection classes have a Closure interface and a number of classes that implement it, that allow you to construct a number of standard closures fairly easily. e.g. a for loop closure

http://commons.apache.org/collections/apidocs/org/apache/commons/collections/Closure.html

This entry was posted in Java and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

502,426 Spambots Blocked by Simple Comments

HTML tags are not allowed.