-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8, 14.0.1
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
Hi, there is a typo in the documentation, interface Map, method replace:
in the specification of the default method value is called instead of oldValue
This is the text readable from the api online on docs.oracle.com:
default boolean replaceâÂÂ(K key, V oldValue,V newValue)
Replaces the entry for the specified key only if currently mapped to the specified value.
Implementation Requirements:
The default implementation is equivalent to, for this map:
if (map.containsKey(key) && Objects.equals(map.get(key), OLDVALUE NOT VALUE )) {
map.put(key, newValue);
return true;
} else
return false;
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
just look at the documentation of interface map on docs.oracle.com, java version 14 (and 9 for what i saw)
FREQUENCY : always
Hi, there is a typo in the documentation, interface Map, method replace:
in the specification of the default method value is called instead of oldValue
This is the text readable from the api online on docs.oracle.com:
default boolean replaceâÂÂ(K key, V oldValue,V newValue)
Replaces the entry for the specified key only if currently mapped to the specified value.
Implementation Requirements:
The default implementation is equivalent to, for this map:
if (map.containsKey(key) && Objects.equals(map.get(key), OLDVALUE NOT VALUE )) {
map.put(key, newValue);
return true;
} else
return false;
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
just look at the documentation of interface map on docs.oracle.com, java version 14 (and 9 for what i saw)
FREQUENCY : always
- duplicates
-
JDK-8243655 Map.replace javadoc code snippet typo
-
- Closed
-