I've been doing some Java work recently and moved to using the latest version of Java and some of its new features like generics and autoboxing. Of course, J2SE 5.0 offers a whole lot more syntactic sugar, but most of the daily work will involve generics and autoboxing.
Generics have been an announced feature for quite a while and bring C 's templated types to Java. This has the useful side effect of removing a lot of casts previously used when using the collection framework. For example, extracting an element from a collection will turn
Element elem=(Element)map.get(key); into
Element elem=map.get(key);, which removes a distracting cast from the code and saves a little typing. Another side effect of having templated types is that type checking can be done at insertion time instead of extraction time.
Autoboxing is another feature which does not fundamentally change the language but makes life a little easier. Basically, types will automatically convert between their object type — Integer, Long, Float, etc. — and their respective primitive type. Here again, this removes a lot of object instantiations and value extraction from the code. Even though this makes code more legible, type conversions still occur in the background and don't magically become free.
Unfortunately, the new generics syntax breaks some tools such as XJavaDoc and XDoclet. This is a tool issue but is still annoying in the meantime. Autoboxing also introduces a potential performance hit within critical loops and is the kind of thing that one is likely to overlook.
[MoonJihad's Page of Nothingness] (Permanent link to this entry) (Comment on this)