/**
主要比较新数组的长度minCapacity,与内部要扩展的长度newCapacity 的大小
* */privatevoidgrow(int minCapacity){// overflow-conscious codeint oldCapacity = elementData.length;int newCapacity = oldCapacity +(oldCapacity >>1);//新的Capacity等于旧Capacity加上Capacity向右位移一位if(newCapacity - minCapacity <0)//
newCapacity = minCapacity;//private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;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);}