The following call chains are replaced by this inspection:
Collection.stream().forEach() → Collection.forEach()Collection.stream().forEachOrdered() → Collection.forEach()Collection.stream().count() → Collection.size()Arrays.asList().stream() → Arrays.stream() or Stream.of()Collections.singleton().stream() → Stream.of()Collections.singletonList().stream() → Stream.of()Collections.emptyList().stream() → Stream.empty()Collections.emptySet().stream() → Stream.empty()Stream.collect(Collectors.counting()) → Stream.count()Stream.collect(Collectors.maxBy()) → Stream.max()Stream.collect(Collectors.minBy()) → Stream.min()Stream.collect(Collectors.mapping()) → Stream.map().collect()Stream.collect(Collectors.reducing()) → Stream.reduce() or Stream.map().reduce()Stream.collect(Collectors.summingInt()) → Stream.mapToInt().sum()Stream.collect(Collectors.summingLong()) → Stream.mapToLong().sum()Stream.collect(Collectors.summingDouble()) → Stream.mapToDouble().sum()
Note that the replacements semantic may have minor difference in some cases.
For example, Collections.synchronizedList(...).stream().forEach() is not
synchronized while Collections.synchronizedList(...).forEach() is synchronized.
Or collect(Collectors.maxBy()) would return an empty Optional if the resulting
element is null while Stream.max() will throw NullPointerException
in this case.