Wrong implementation of Oracle Java ConcurrentHashMap?
I am testing ConcurrentHashMap on Oracle's Java 8 implementation: ConcurrentMap<String, String> concurrentMap = new ConcurrentHashMap<>(); String result = concurrentMap.computeIfAbsent("A", k -> "B"); System.out.println(result); // "B" result = concurrentMap.putIfAbsent("AA", "BB"); System.out.println(result); // null The Javadoc of computeIfAbsent does say that Implementation Requirements: The default implementation is equivalent to the following steps for this map, then returning the current value or null if now absent: if (map.get(key) == null) { V newValue = mappingFunction.apply(key); if