You are mixing a few things up here.
we know that on compilation generic classes are transformed into raw form
Basically true, it's called type erasure.
List<String> a=new Arraylist<String>
is effectively the same for
List<String> a=new Arraylist<>
Not in the sense of type erasure. Simply put, when compiling, List<String> a=new Arraylist<String>
, is "changed" to List a=new Arraylist
The example you have brought up, is a new feature in Java 7. You can ommit the generic parameter on the right hand side of the assignment und just use the so called "diamond operator". This is where your statement becomes true. Prior to Java 7, you cannot do this.