I have following code:
List<Integer> ints = Arrays.asList(1,2,3,4);
asList, defined in java.util.Arrays is as:
public static <T> List<T> asList(T... a) {
return new ArrayList<>(a);
}
And AaaryList constructor is defined as:
ArrayList(E[] array) {
a = Objects.requireNonNull(array);
}
I was expecting to find some code for autoboxing,and some code which determines type of the elements passed to asList method as we can pass any type to asList, but no such code is there.
So how does all this type detection, autoboxing etc occurs in this entire scheme of things.