Do not suggest computeIfAbsent <=> putIfAbsent conversions if value could be nullable

Fixes IDEA-215931 Incorrect "Excessive lambda usage" warning

GitOrigin-RevId: 13fa8f5d7d283cd7a208053ed0271a644b713391
This commit is contained in:
Tagir Valeev
2019-06-14 14:20:58 +03:00
committed by intellij-monorepo-bot
parent ceb5edd14f
commit 9366f0ec2a
3 changed files with 50 additions and 17 deletions
@@ -0,0 +1,8 @@
// "Use 'putIfAbsent' method without lambda" "false"
import java.util.Map;
class Test {
public void test(Map<String, String> map, String key, String value) {
map.computeIfAbsent(key, k <caret>-> value);
}
}
@@ -0,0 +1,12 @@
// "Use 'computeIfAbsent' method with functional argument" "false"
import java.util.Map;
class Test {
public void test(Map<String, List<Integer>> map, String key) {
map.putIfAbsent(key, createList<caret>());
map.get(key).add(0);
}
private native List<Integer> createList();
}