一文读懂HashMap和HashTable的区别以及常见面试题(17)


                    oldCap >= DEFAULT_INITIAL_CAPACITY)                newThr = oldThr << 1; // double threshold
               else if (oldThr > 0) // initial capacity was placed in threshold
           newCap = oldThr;        else {               // zero initial threshold signifies using defaults
           newCap = DEFAULT_INITIAL_CAPACITY;            newThr = (int)(DEFAULT_LOAD_FACTOR * DEFAULT_INITIAL_CAPACITY);
               if (newThr == 0) {
           float ft = (float)newCap * loadFactor;            newThr = (newCap < MAXIMUM_CAPACITY && ft < (float)MAXIMUM_CAPACITY ?
                     (int)ft : Integer.MAX_VALUE);

推荐阅读