The following call chains are replaced by this inspection:
Collection.stream().forEach() → Collection.forEach()Collection.stream().forEachOrdered() → Collection.forEach()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.filter().findFirst().isPresent() → Stream.anyMatch()Stream.filter().findAny().isPresent() → Stream.anyMatch()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()!Stream.anyMatch() → Stream.noneMatch()!Stream.anyMatch(x -> !(...)) → Stream.allMatch()!Stream.noneMatch() → Stream.anyMatch()Stream.noneMatch(x -> !(...)) → Stream.allMatch()Stream.allMatch(x -> !(...)) → Stream.noneMatch()!Stream.allMatch(x -> !(...)) → Stream.anyMatch()
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.