A checklist for tasks that could be performed on an existing Java 2 sourcecode when migrating to Java 5+:

  • use Generics always and everywhere
  • use autoboxing (remove all “new Integer” etc)
  • replace overloaded methods with var-args
  • use Enums instead of integer constants
Replace class…  …with class…  …because…
StringBufferStringBuilderbetter performance (not threadsafe)
BufferedWriter, FileWriterPrintWriterenhanced formatting
StringTokenizerScannerincludes parsing
IteratorIterable(for APIs) enhanced “for” loop can be used