I would like to convert an Integer[] but toArray() is giving me Object[]. How can I convert it to String[]?
Stream.of(ids).map(String::valueOf).toArray();
String[] array = Stream.of(ids).map(String::valueOf).toArray(String[]::new);
Arrays.stream instead. This will consistently work for int[], long[] and double[] as well (you only have to use mapToObj instead of map then), whereas Stream.of only works for boxed values and it’s intended use case is the varargs invocation like Stream.of(a, b, c)…
int[]or anInteger[]?