Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-822

cache the hash calculation in ObjectId

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Object ids are used in maps and sets all over the place. It makes sense to cache the hash computation in a similar manor as the String.hashCode() method.

      From String.java

          public int hashCode() {
          int h = hash;
              int len = count;
          if (h == 0 && len > 0) {
              int off = offset;
              char val[] = value;
      
                  for (int i = 0; i < len; i++) {
                      h = 31*h + val[off++];
                  }
                  hash = h;
              }
              return h;
          }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            rn@deftlabs.com Ryan Nitz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: