IDEA-200455 Suggest to replace (a, b) -> a + b lambdas with Integer::sum, Long::sum, Double::sum

This commit is contained in:
Tagir Valeev
2019-01-31 14:20:20 +07:00
parent cde7d6a7ff
commit 8da8dca8e0
14 changed files with 95 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ import java.util.stream.Collectors;
public class Main {
private Map<String, Integer> test(String... list) {
Map<String, Integer> map = Arrays.stream(list).filter(Objects::nonNull).collect(Collectors.toMap(s -> s, s -> 1, (a, b) -> a + b));
Map<String, Integer> map = Arrays.stream(list).filter(Objects::nonNull).collect(Collectors.toMap(s -> s, s -> 1, Integer::sum));
return map;
}