Well as Sun is about to launch Musthang ,most of us has still not started using Java 5.0 to its full potential.
Well if you are using Eclipse than its version 3.1 onwards has incoprated the support for Tiger but default
setting are still to Jdk 1.4 which is kind of Sad as eclipse guys should have done this.Anyway you can go to
windows—>prefrences—->java —>compiler –>compiler compliance level to 5.0
Their are numerous changes but as a programmer we guys would be mainly concerned with the “Language Features”
So they are :
Just go through the links and you’ll get hang of these.Even if you are short of time i’ll recommend “Generics “
“Enhanced For Loop” as effect of these featurs on a code from readability prespective is huge.
Here their are doubts about performance while using these features so lets analyse them.
1) In Generics ,their is no impact on Run-time performance as compiler would remove them from class files!
Yes this is only compile time check and ArrayList<Interger> a=new ArrayList<Interger>(); and
ArrayList a=new ArrayList(); will be same at Run-time.Compiler will do the explict casting in the code
and not you so code will be cleaner and easier to read.
2) In AutoBoxing and unBoxing again performance will be same as whaterver casting you would have done will
be done by compiler but essentially the code will be same.
But be carefull while using this feature with Gernerics ,see the code below
ArrayList<Integer> intArraylist=new ArrayList<Integer>();
And boom their will be nullPointer when ideally you were dealing with primitives.
But still this is easier to debug than nasty ClassCastException as somebody has added
some other class in ArrayList.Dont worry about this in Tiger.
One more thing worth metioning is Concurrency Utilities : A comprehensive library of concurrency utilities has been developed and included in Java 5.0