Harmony
  1. Harmony
  2. HARMONY-403

HashMap hashcode ignores values in entries

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Estimated Complexity:
      Moderate

      Description

      While it is obviously trivial to create different HashMaps with identical hashCodes, I'd still expect the following test code to pass:

      HashMap map1 = new HashMap(10);
      HashMap map2 = new HashMap(10);
      map1.put("key", "1");
      map2.put("key", "2");
      assertFalse(map1.hashCode() == map2.hashCode());

      That is, I'd expect the 'value' associated with "key" to have some impact on the hashCode. It passes on the reference implementations I tested.

      1. hashmap.hashcodes.should.differ.diff
        1 kB
        Mark Hindess
      2. fix.hashmap.hashcode.diff
        0.7 kB
        Mark Hindess

        Issue Links

          Activity

          Nathan Beyer made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Nathan Beyer made changes -
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Resolved [ 5 ]
          Nathan Beyer made changes -
          Link This issue is related to HARMONY-206 [ HARMONY-206 ]
          Nathan Beyer made changes -
          Status Resolved [ 5 ] Reopened [ 4 ]
          Estimated Complexity Moderate
          Resolution Fixed [ 1 ]
          Nathan Beyer made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Nathan Beyer made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Nathan Beyer made changes -
          Assignee Nathan Beyer [ nbeyer ]
          Mark Hindess made changes -
          Attachment hashmap.hashcodes.should.differ.diff [ 12325766 ]
          Mark Hindess made changes -
          Field Original Value New Value
          Attachment fix.hashmap.hashcode.diff [ 12325764 ]
          Mark Hindess created issue -

            People

            • Assignee:
              Nathan Beyer
              Reporter:
              Mark Hindess
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development