I have the following code
public class Test{
private static final String key = "key";
public static void main(String[] a){
ConcurrentHashMap<String,String > map = new ConcurrentHashMap<String,String>();
System.out.println(map.replace(key,"1"));
System.out.println(map.replace(key,"2"));
}
}
The output is null both times. Isn’t it supposed to be 1 second time?
The doc says:
Hence no, the first replace doesn’t do the put.