Rod Waldhoff's Weblog  

< Wednesday, 2 April 2003 >
Some Planned JDK 1.5 Features #
On Ward's Wiki, I stumbled across a link to "An enhanced for loop for the Java Programming Language" which is part of JSR 176: J2SE 1.5 (Tiger) Release Contents. It seems this will allow one to write:
for(String str : myCollection) {
  System.out.println(str);
}
as syntactic sugar for:
for(Iterator iter = c.iterator(); iter.hasNext(); ) {
  System.out.println((String)(iter.next()));
}

In addition, the document describes some changes to Java Iterators to support this.

This in and of itself is neat. Some URL hacking on that link leads to a list of files documenting some other interesting features, including:

It's strange that Java's "Community" Process doesn't expose this sort of detail more publicly. I'm unable to find a link to these documents on either of jcp.org or java.sun.com.

Googling on "JDK 1.5" yields some hits, including an entry from Henri's blog and several others, a brief article from java.sun.com, even an article on slashdot, all dated at least a month ago, so maybe this is old news to many of you.

(JSR 14 adding C++ template style generics to Java is another major change planned for JDK 1.5 it seems, but that one's been pretty widely known. I wonder if generics together with autoboxing will allow me to replace the org.apache.commons.collections.primitives package?)