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

Some SA classes could use better hashCode() implementation

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • hotspot
    • None
    • b23

          public int hashCode() {
              // FIXME: suggestions on a better hash code?
              return (int) addr;
          }

      The upper 32-bits of the addr long value could be used in the hash code calculation. Long.hashCode(long value) can be used to accomplish this:

           (int)(this.longValue()^(this.longValue()>>>32))

            cjplummer Chris Plummer
            cjplummer Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: