Java 1.6 (officially called as Java SE 6) is released few days back. It includes a number of new API including Manangement API for JVM, Zipped output & input streams, etc. Along with Deque and NavigatableSet in java.util, they have added a new class in the java.util called ServiceLoader. Sounds to be a fine addition, yet to play with it. They have quiely slipped in a new method for copying arrays:
Earlier it was:
int newArray = new int[newLength];
System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
now with the new API,
int newArray = Arrays.copyOf(a, newLength);
With copyOf and copyOfRange methods, now Arrays class is really useful when you manipulate the array sizes. It took so many years for Sun to figure out the right need for such a useful API!