List listOne = new LinkedList<Shxx>();
List<Shxx> listTwo = new LinkedList<Shxx>();
List listThree = new LinkedList();
List<Shxx> listFour = new LinkedList();
List listOne = new LinkedList<Shxx>(); List<Shxx> listTwo = new LinkedList<Shxx>(); List listThree = new
Share
Throws away the type information, might as well not use generics at all.
Correct full use of generics, provides type safety.
No use of generics (i.e. pre Java 5 code), no type safety.
Will cause a compiler warning, but otherwise OK because the list can only be used through the typesafe reference and is initially empty. Shouldn’t be done anyway because if you ignore compiler warnings concerning the use of raw types, you could also be ignoring others that are not as benign as this one. The best way to get the maximum type safety out of generics is to eliminate all related compiler warnings.