« March 2007 | Main | May 2007 »

April 2007 Archives

April 27, 2007

Closures in Java: Too Much Typeing!

A consensususes has been reached on adding Closures to Java 7. While this is good for Java I'm afraid I may never use it because there is just too much typing. My fingers will get sore typing out all those class names! Either that or my spacebar will break when the IDEs catch up. Let's do a small comparison of some of the samples from the currently proposed Java closures specification and Groovy. First: Java,

{int,int=>int} plus = {int x, int y => x+y};

45 characters and 5 types. Now for groovy:

def plus = {x, y -> x+y};

23 characters, whoops, 22 because the semi-colon is not needed. And only one type (if you count the any-type 'def'), zero if you execute it in a script. Of course the Java version will likely run in less than one hundredth of the time *ducks*.

About April 2007

This page contains all entries posted to ... And They Shall Know Me By My Speling Errors in April 2007. They are listed from oldest to newest.

March 2007 is the previous archive.

May 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33