HashMap

static final int MAXIMUM_CAPACITY = 1 << 30;
最大容易为1<<30;初始化时不能超过这个容易,
if (initialCapacity > MAXIMUM_CAPACITY)
            initialCapacity = MAXIMUM_CAPACITY;
如果超过则只会初始化1<<30



初始化容量的取得
        int capacity = 1;
        while (capacity < initialCapacity)
            capacity <<= 1;

capacity(2^n) >= initialCapacity


The next size value at which to resize(threshold)  = capacity X于  加载因子



你可能感兴趣的:(HashMap)