Skip to main content

Replaced `Stream.collect(Collectors.toList())` with `Stream.toList()` (Sonar)

sonar:java/replace-stream-collectors-to-list-s6204​

ImportanceReview GuidanceRequires Scanning Tool
LOWMerge Without ReviewYes (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();

References​