This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In my program I have taken two arrays one is String array another is int array .When I convert these two arrays into List through Arrays.asList(). But list which is created from int has the size that is not equal to the array length,but the that is created from String has the same size as the length of the String.Why the size of the list that is created from int array is one?
prints Length of the arr=10 Elements in th list =1 *********************** length of the array =5 Elements in the list =5
The asList() method requires an array of objects. An array of ints is *not* an array of objects. However, since the method is written to take var-args, it takes an array of one object -- the int array. Hence, the list of size one.