-
Bug
-
Resolution: Unresolved
-
P4
-
11, 17, 19, 20, 21
A DESCRIPTION OF THE PROBLEM :
Page:
https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/Map.html#containsKey(java.lang.Object)
says:
Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Objects.equals(key, k). (There can be at most one such mapping.)). (There can be at most one such mapping.)
However, no Objects.equals(key, k) exists. In class Object there is a method
equals(Object obj) that has only one argument.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open the page.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
That the page tells exactly what method is called to determine equality.
And that tells also that the class of the key MUST implement both
public boolean equals(Object other)
and
public int hashCode()
If the intended behavior is that of equality of contents.
Page:
https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/Map.html#containsKey(java.lang.Object)
says:
Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Objects.equals(key, k). (There can be at most one such mapping.)). (There can be at most one such mapping.)
However, no Objects.equals(key, k) exists. In class Object there is a method
equals(Object obj) that has only one argument.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open the page.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
That the page tells exactly what method is called to determine equality.
And that tells also that the class of the key MUST implement both
public boolean equals(Object other)
and
public int hashCode()
If the intended behavior is that of equality of contents.