public class PositiveNumbers {
public static List<Integer> positive(List<Integer> numbers){
return numbers.stream()
.mapToInt(Integer::valueOf)
.filter(s -> s >= 0)
.collect(Collectors.toCollection(ArrayList<Integer>::new));
}
}
Image of the code and description of problem given by IntelliJ
Tried all that program gives as fix, asked chatGPT, but no results. I cannot see the problem.
I tried also
.collect(Collectors.toList());
but same problem...