The following is throws compile error
:
int[] arrs = {1,2,4,3,5,6};
List<Integer> arry = Arrays.asList(arrs);
but this works:
for (Integer i : arrs){
//do something
}
Auto-boxing works in many contexts, I just gave one example of for-loop
above. but it fails in the List-view
that I make in Arrays.asList()
.
Why does this fail and why is such as a design implementation chosen?