Closed foal closed 3 years ago
Yes, it's an unfortunate consequence of Java type system and there's nothing that could be fixed on the library side. You can avoid this problem adding a bogus .<R>map(x -> x)
step or just using traditional .collect(Collectors.toList());
. Note that it's planned to add to Java 16 a new toList()
method right into the java.util.Stream
, and it will suffer the same problem.
Have a simple code
So part with StreamEx can't be compiled due to the error:
Type mismatch: cannot convert from List<capture#19-of ? extends R> to List<R>