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*.