Many know about generics, collections enhancements and auto-boxing, varargs, annotations ,but there are some less popular features added to java in Java5 and Java6. I'm going to point the lights on them, because they are little treasures:
- Formatter class - easy to use class for proper formatting of numbers, date-time, currency etc
- Scanner class - slower but comfortable to use to read text from streams
- java.util.concurrency.* package - atomic classes introduced. You are going to use them if you are in a concurrent environment... Also locks and some thread-safe collections
- JMX was added to J2SE --- instrumentation, management for your applications, MBeans - you name it
- Arrays.fill() -- fills an array with a value you give it. Very useful instead of writing a loop and doing it manually.
- Arrays.deepToString(); --- another great static method -- instead of writing a recursion method to print the toString method of the elements in a multi-dimensional array, you just use this method !
- JTable printing - it looks more natural to have a native printing method
- Deque --double-ended queue was added as an interface in the collections package
- int newArray = Arrays.copyOf(anotherArray, newLength); --- faster and cooler than System.arraycopy(..)
- drag'n'drop improved --- they made it more usable, but how exactly - I haven't tried it to tell you
- JTable sorting and filtering added
- Console class added
- new methods in File - getTotalSpace(), getFreeSpace(), getUsableSpace() --- why create a file and fill it with some data when you can first check if there is enough space in the drive to create the file in the first place?
- java.util.zip.DeflaterInputStream: Data read from this stream is compressed.
java.util.zip.InflaterOutputStream: Data written to this stream is decompressed.
Or in normal human language - something like a Zip Streams where data is compressed . Nice! I am sure to use it next time!
- JMX was greatly fixed and update so my suggestion is to use it on this JRE6 version.
- JSR 223: Scripting for the Java™ Platform API -- This is a framework by which Java Applications can "host" script engines
So Java guys, out there, don't miss out these features and have in mind the enhancements :)