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

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 *

HTML tags are not allowed.

517,234 Spambots Blocked by Simple Comments