Mark Watson’s Artificial Intelligence Books and Blog

Share this post

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

markwatson.com

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

Mark Watson
Jan 17, 2005
Share
Share this post

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

markwatson.com

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.

Share
Share this post

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

markwatson.com
Comments
Top
New

No posts

Ready for more?

© 2023 Mark Watson
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing