Files
openide/java/java-tests/testData/inspection/java8MapApi/afterCompute.java
Daria Nikolskaiaandintellij-monorepo-bot dd7f92d48a IDEA-200789: Suggest to use Map.compute() instead of Map.get() + Map.put()
(cherry picked from commit 484148216a2c29613043695ef3f69238118946a9)

IJ-CR-117655

GitOrigin-RevId: 8a95550370e3ee03ec02420254fe2e2287eedf51
2023-10-30 20:55:19 +00:00

8 lines
230 B
Java

// "Replace with 'compute' method call" "true"
import java.util.Map;
public class Main {
public void testCompute(Map<String, Integer> map, String key) {
map.compute(key, (k, value) -> value == null ? 0 : value + 1);
}
}