cushon / issues-import

0 stars 0 forks source link

Arrays.asList(primitive[]) #208

Open cushon opened 9 years ago

cushon commented 9 years ago

Original issue created by lowasser@google.com on 2013-11-09 at 12:24 AM


For example, Arrays.asList(int[]) returns a List<int[]> where many people expect a List<Integer>. An appropriate substitute would be to use Guava's Ints.asList(int[]), and so on for the other primitive types.

cushon commented 9 years ago

Original comment posted by kevinb@google.com on 2013-11-09 at 01:40 AM


For any case where the user actually wanted a List<int[]> (and don't want to modify it) we should make them use Collections.singletonList() instead to avoid the extreme confusion.

I'm curious what people are doing with these things though; they might be trying to reinvent various Arrays methods and such.