Java anonymous classes are really, really verbose. Besides the sheer number of templates that you only need to define them, some of the Java design decisions mean that many common tasks are much more verbose than in other languages. For example, importing modified values into closures is a pain in the ass in Java.
Basically, Java does not support upvalues; instead, they are modeled by passing them (by value) to the class via invisible parameters to the class constructor. Since they are passed by value, changing them inside the class will not affect the copy in the method that the class built, so the compiler forces you to declare them final to avoid confusion. eg:.
Runnable function() { final int i = 4; return new Runnable() { public void run() { System.out.println("i="+i);
In cases where you need to change a variable, for example, in almost every case where closing would be useful, you should trick:
Runnable function() { final int[] i = new int[1]; i[0] = 4; return new Runnable() { public void run() { System.out.println("i="+i[0]); i[0] = i[0] + 1; } } }
Here i itself is still immutable, but since it points to an object to be modified, I can change the contents of the object. (Naturally, in real life, I would use a class, not an array, because using arrays is really ugly, and this makes it even more verbose.)
I understand that the next release of Java will have syntactic sugar to make it all easier, but right now, closing-based programming is pretty cumbersome in Java. It is often easier for me to change the logic so as not to use closure, just so that I can keep the amount of code used small enough to be clear.