Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8307126

add links to Objects.equals(obj, obj) from Map methods

XMLWordPrintable

      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.

            smarks Stuart Marks
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: