Why can’t I map integers to strings when streaming from an array?
Arrays.stream(int[]) creates an IntStream, not a Stream<Integer>. So you need to call mapToObj instead of just map, when mapping an int to an object. This should work as expected: String commaSeparatedNumbers = Arrays.stream(numbers) .mapToObj(i -> ((Integer) i).toString()) //i is an int, not an Integer .collect(Collectors.joining(“, “)); which you can also write: String commaSeparatedNumbers = Arrays.stream(numbers) … Read more