189 |
|
* @param minCapacity the desired minimum capacity |
190 |
|
*/ |
191 |
|
private void growArray(int minCapacity) { |
192 |
< |
if (minCapacity < 0) |
192 |
> |
if (minCapacity < 0) |
193 |
|
throw new OutOfMemoryError(); // int overflow |
194 |
|
int oldCapacity = elementData.length; |
195 |
|
// Double size if small; else grow by 50% |
414 |
|
modCount++; |
415 |
|
if (s >= elementData.length) |
416 |
|
growArray(s + 1); |
417 |
< |
System.arraycopy(elementData, index, |
417 |
> |
System.arraycopy(elementData, index, |
418 |
|
elementData, index + 1, s - index); |
419 |
|
elementData[index] = element; |
420 |
|
size = s + 1; |
437 |
|
E oldValue = (E)elementData[index]; |
438 |
|
int numMoved = s - index; |
439 |
|
if (numMoved > 0) |
440 |
< |
System.arraycopy(elementData, index + 1, |
440 |
> |
System.arraycopy(elementData, index + 1, |
441 |
|
elementData, index, numMoved); |
442 |
|
elementData[s] = null; |
443 |
|
size = s; |