db4o Developer Community

db4o open source object database, native to Java and .NET
Welcome to db4o Developer Community Sign in | Join
in Search
More Search Options

Carl Rosenberger's web log

Closures in Java 7, please !!!

Currently there is a poll on http://www.java.net

"What one feature would you most like to see in JDK 7"

Closures are one possible choice. Closures would be soooo niiiiiiiice. Here is why:

List cats = database.query( { Cat cat => cat.getName().equals("Wolke") } );

Can Native Queries be more beautiful?

 

This is a cry to the db4o community:

Please vote for closures!

 

Some further links on closures:

http://www.javac.info/closures-v04.html

http://www.bejug.org/confluenceBeJUG/display/PARLEYS/Closures+for+Java

http://gafter.blogspot.com/2006/12/closures-talk-and-spec-update.html

 

Published Sunday, January 21, 2007 9:23 PM by Carl Rosenberger
Filed under: ,


Comments

 

Eric Falsken said:

My C# Native Queries already look like that. Java needs closures too. I love anonymous methods.

List<Foo> l = new List<Foo>();

l.ForEach(delegate(Foo f){

   do something to all of the Foo in l;

 });

Btw, it makes RemoveAll and Sort really nice too.

January 21, 2007 9:00 PM
Anonymous comments are disabled