src/share/classes/java/util/concurrent/ConcurrentMap.java

Print this page
rev 8834 : 8029055: Map.merge and ConcurrentMap.merge @implSpec is not correct in case of non-existing key-value pair or a null value entry
Reviewed-by: duke

@@ -471,12 +471,10 @@
      * V oldValue = map.get(key);
      * V newValue = (oldValue == null) ? value :
      *              remappingFunction.apply(oldValue, value);
      * if (newValue == null)
      *     map.remove(key);
-     * else if (oldValue == null)
-     *     map.remove(key);
      * else
      *     map.put(key, newValue);
      * }</pre>
      *
      * <p>The default implementation may retry these steps when multiple