So I am trying to convert an (primitive) int array to a List,
for(int i=0;i<limit;i++) {
arr[i]=sc.nextInt();
}
List list=Arrays.asList(arr);
System.out.print(list);
Doing this so prints values like this for example, [[I@59a6e353]
. There is an option to add <Integer>
before variable list but since the array is primitive int, it could not.
Is there any solution for this? Adding <int[]>
before variable list isn't an option as I need to call a bounded wildcard method.