The fact that a raw type of generic class can take all different variations of that generic class is matter of Java compatibility? -


I have noticed that a raw type of a normal class can take all the various forms (points) of the normal class and all the normal Different types of squares can take the raw type (points) of the normal class. Why does Java Generation behave like this? Is it purely due to compatibility with older versions of Java?

Example:

  // main Java public class main {/ ** * @ ultimate arguments * / public static zero main (string [] args) {list list raw = new array list (); & Lt; Students & gt; List qualifies = new arrelisted & lt; Students & gt; (); List & lt ;? & Gt; ListUnbounded = New Arrestists & lt; Students & gt; (); List & lt;? Students & gt; Expand ListUpBounded = New Arrestists & lt; Students & gt; (); List & lt;? Super student & gt; List Downbound = New Arrestist & lt; Students & gt; (); // raw list list list can take all the different forms of rawList1 = listRaw; Catalog rawList2 = lists worthy; List rawList3 = listUnounded; List rawList4 = listUpBounded; List rawList5 = listDownBounded; // List all the different variations of the list raw type list Raw = rawList1; Listable = Raw List 2; ListNext = CapsLost3; List UPBounded = rawList4; List Downbound = Raw List 5; }} // Lok.Java Lok class {People of the public stable class} {} extends the public square, the history student extends {} Public classes extends the MathStudent student {}}    

One of the main challenges facing the Sun Engineers to maintain the previous compatibility was, for example, if You are not able to assign:

  list su Mr. = new Arrelist & lt; Students & gt; ();   

Then, you will not be able to use old library methods. I.e.:

  list org.apache.commons.collections.ListUtils.intersection (list arg0, list arg1)   

Also remember those types which Rendered on runtime

Comments