Files
2026-01-16 13:57:13 +00:00

16 lines
335 B
Java

// "Replace with 'putIfAbsent()' 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);
}
}