Vinay M Raju wrote:Very useful information. Thansk a lot !!
It should be pointed out that Anish's code is redundant. What Ernest was trying to highlight is that
Arrays.asList() returns a
List, not an
ArrayList (actually, the List
is an ArrayList - at least right now - but you shouldn't take it for granted).
It's almost invariably best to use interfaces anyway, so far better is:
List<Integer> myArray = Arrays.asList(1,2,3);
Randall Twede wrote:very interesting topic but i would have just used an array
Then you're missing out. Apart from fixed-length primitive arrays and
String.split(), I hardly ever use them any more.
Winston