标签:aci sci element max 原来 int col div this
private void grow(int minCapacity) { // overflow-conscious code int oldCapacity = elementData.length; int newCapacity = oldCapacity + (oldCapacity >> 1); if (newCapacity - minCapacity < 0) newCapacity = minCapacity; if (newCapacity - MAX_ARRAY_SIZE > 0) newCapacity = hugeCapacity(minCapacity); // minCapacity is usually close to size, so this is a win: elementData = Arrays.copyOf(elementData, newCapacity); }
动态扩容后的大小为原来大小的1.5倍;
标签:aci sci element max 原来 int col div this
原文地址:https://www.cnblogs.com/jayinnn/p/11038993.html