posted 12 years ago
Hey all,
As title says, I'm trying to construct and arraylist from int array. The problem is it does not autobox ints. If generics are not used such as ArrayList x = new ArrayList(Arrays.asList(intArray)) then you cannot compare the integers, because they are converted to objects and > operator does not work, but if i do it like ArrayList<Integer> x = new ArrayList(Arrays.asList(intArray)) then i get class cast exception, which leaves me with a question, is there even a way to do this? this kind of conversion is very common so i don't believe there is no way. Thanks for any help in advance.