I've got a sequence of integers (List<Integer>) and want to convert it to a string. I don't see why this code doesn't work:
sequence.stream().map(n -> n == 1 ? "+" : (n == -1 ? "-" : Integer.toString(n))).collect(Collectors.joining(","));
As you see, I want 1 to be represented as + and -1 as -.
I get the error message Type mismatch: cannot convert from Stream<Object> to <unknown>.