Replaced `Stream.collect(Collectors.toList())` with `Stream.toList()` (Sonar)
sonar:java/replace-stream-collectors-to-list-s6204​
Importance | Review Guidance | Requires Scanning Tool |
---|---|---|
LOW | Merge Without Review | Yes (Sonar) |
This change modernizes a stream's List
creation to be driven from the simple, and more readable Stream#toList()
method.
Our changes look something like this:
- List<Integer> numbers = someStream.collect(Collectors.toList());
+ List<Integer> numbers = someStream.toList();