performance bug in HashMap.putAll

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P5
    • None
    • Affects Version/s: 1.4.0
    • Component/s: core-libs
    • None

      There is a performance bug in HashMap.putAll. The logic to pre-expand
      the array is not correct. The code might cause the array to be
      expanded twice instead of once, for example when
              threshold = 8
              size = 7
              t.size() = 15
              loadFactor = 1

      The correction is to add the line
              n += size;
      after the lines
              if (n == 0)
                  return;

            Assignee:
            Josh Bloch (Inactive)
            Reporter:
            Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: