Monday, January 17, 2005

I have finally switched to Java 5 language features for new development

Not for consulting work (yet), but for my own development for new code, I am starting to use the new JDK 1.5 (or 5) language features. Since I run under Mac OS X, you might think that this is a problem, but I have a Linux box on my home office network and I simply use X Windows on my Macs. One of the things that I have always loved about Common Lisp and Python is how concise code can be; the new Java language features help a lot. For a contrived example:
import static java.lang.System.out;

import java.util.*;

public class test {
public static void main(String[] args) {
out.println("JDK 5 new language features\n");
List<String> strs = new ArrayList<String>();
strs.add("cat"); strs.add("dog");
for (String s : strs) out.println(" " + s);
Cool, but this is still pretty weak compared to Python's list comprehensions, etc.