It seems like growing interest in dynamic languages will finally move Java syntax toward local functions and closures. Gilad Bracha, Neal Gafter, James Gosling and Peter von der Ahé have written a specification proposal (PDF) for adding closures and local functions to the Java programming language for the Dolphin release.

The specification looks very promising. Here are the two basic examples from the specification that shows how future features could look like:

Local functions

public static void main(String[] args) {
    int plus2(int x) { return x+2; }
    int(int) plus2b = plus2;
    System.out.println(plus2b(2));
}

Closures

int(int) plus2b = (int x) {return x+2; };

As authors state, this specification is only to be used as a starter for the broader discussion, so I hope we’ll hear much more on this topic in the future.
I’m glad that proven dynamic concepts, such as closures, will finally get their place in Java. It’s a pitty that closures will not be available for developers for several more years, but better late than never.

Here are some more links for you to follow: