I have this array:
Integer[] originalItems = itemsArray.stream()
.distinct()
.sorted()
.toArray(Integer[]::new);
I would like to return it as int[]
rather than as Integer[]
.
I have tried to call .toArray(int[]::new)
but I get this error:
no instance(s) of type variable(s) A exist so that int[] conforms to A[]