Files
openide/java/java-tests/testData/inspection/java8MapApi/beforePutIfAbsent.java
T
2016-11-29 13:35:30 +07:00

16 lines
340 B
Java

// "Replace with 'putIfAbsent' method call" "true"
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
Map<String, String> vals = new HashMap<>();
String v = vals.get("foo");
if(v <caret>== null) {
vals.put("foo", "bar");
}
System.out.println(v);
}
}