Files
openide/java/java-tests/testData/inspection/java8MapApi/afterComputeWithComments.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
318 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/*7*/./*8*/compute/*9*/(/*10*/key/*11*/, /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ (k, value) -> value /*12*/ == /*13*/null ? 0 : /*14*/value + 1)/*15*/;
}
}