User Tools

Site Tools


java_faq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
java_faq [2016/09/22 13:44]
178.237.8.52 [ArrayList]
java_faq [2017/01/02 15:01] (current)
178.237.8.52 [ArrayList]
Line 273: Line 273:
   list2 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]   list2 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  
-that means that ''​list1''​ is a list which contains an int[], while the other is what we expected to find. This has to do with [[https://​docs.oracle.com/​javase/​tutorial/​java/​generics/​types.html | Java generics]]. Java generics is the analogous of ''​templates''​ in C++, but while in C++ anything can be a ''​typename''​ in Java ''​a type variable can be any NON-PRIMITIVE type''​.+that means that ''​list1''​ is a list which contains an int[], while the other is what we expected to find. This has to do with [[https://​docs.oracle.com/​javase/​tutorial/​java/​generics/​types.html | Java generics]]. ​[[Java generics]] is the analogous of ''​templates''​ in C++, but while in C++ anything can be a ''​typename''​ in Java ''​a type variable can be any NON-PRIMITIVE type''​.
  
  
 In our example I used an array of primitives, which is the only object in the matter and Java used it to perform the transformation to List, as it is a non-primitive object. Therefore ''​list1''​ is a List containing one element of type ''​int[]''​. In our example I used an array of primitives, which is the only object in the matter and Java used it to perform the transformation to List, as it is a non-primitive object. Therefore ''​list1''​ is a List containing one element of type ''​int[]''​.
  
java_faq.txt ยท Last modified: 2017/01/02 15:01 by 178.237.8.52