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.
System.out.print(Arrays.toString(list))int[]array:List<Integer> list = IntStream.of(array).boxed().toList()- BTW it is recommended not to use raw types! JLS 4.8: "The use of raw types is allowed only as a concession to compatibility of legacy code. The use of raw types in code written after the introduction of generics into the Java programming language is strongly discouraged. It is possible that future versions of the Java programming language will disallow the use of raw types."