The language talks at JavaOne had a good attendance. At first you may feel “geez, how about getting real security in EJBs … that is more important than a damn for shortcut”. But these things do matter.

I have been involved in many communities, and maybe none like the Perl community. Since they are lead by a linguist (Larry Wall), the language is very different. You may say that it is too complicated, too easy to make it look like line-noise, etc…. but has two characteristics:

  • Fun: You can do things how you want, and have fun trying to do weird things [yes, this may not lead to the best code ;)]
  • Restricted: You do not feel at all restricted with this language. You can do things however YOU want [again, maybe not the best idea for the masses

For me, items like a simple foreach construct help a lot.
Now code like Cedric’s and Cameron’s go from:

public boolean containsAll(Collection c) {
  for(Iterator iter = c.iterator(); iter.hasNext();) {
    if (!contains(iter.next()) {
      return false;
    }
  }
  return true;
}

to:

public boolean containsAll(Collection c) {
  for (Object o : c) {
    if (!contains(o)) return false;
  }
  return true;
}

Not a BIG deal sure, but a bit cleaner none the less. Then you get to nested loops like:

List deck = new ArrayList(52);
for (Suit suit : Suit.VALUES)
   for (Rank rank : Rank.VALUES)
      deck.add(new Card(suit, rank));
      Collections.shuffle(deck);

and you see the beauty come through (and it just works… no chance to screw up a “i.next();”.

I may have prefered to have foreach as a keyword here (or even like Perl where you can use either), but again, that isn’t a HUGE deal to me. I do worry more about adding “enum” as a keyword, as how many times have you done: Enumeration enum = …; (Rickard has pointed out).

Along with Generics, Enums, Autoboxing, metadata, and the rest… 1.5 will be a brave new world. I know it will take awhile to get here, and will take even longer to work out how best to use things like metadata… it has brought back some fun to our language. Let’s keep it coming.