Fix System.arraycopy when the source and dest are the same

This commit is contained in:
Eric Scharff
2007-09-27 15:06:56 -06:00
parent 101b0c3b0e
commit 2ae6aa7ddf
2 changed files with 2 additions and 2 deletions

View File

@ -70,7 +70,7 @@ public class ArrayList<T> implements List<T> {
public void add(int index, T element) {
size = Math.max(size+1, index+1);
grow();
System.arraycopy(array, index, array, index+1, size-index);
System.arraycopy(array, index, array, index+1, size-index-1);
array[index] = element;
}