ArrayList.java (addAll(int,Collection)): System.arraycopy all of the remaining elements.

* java/util/ArrayList.java (addAll(int,Collection)): System.arraycopy
        all of the remaining elements.
        * java/util/Vector.java (addAll(int,Collection)): Likewise.
        (removeRange): If toIndex == fromIndex do
        nothing, if toIndex < fromIndex throw IndexOutIfBoundsException.
        (removeAll): Always throw NullPointerException when collection is
        null.
        (retrainAll): Likewise.

From-SVN: r51979
This commit is contained in:
Mark Wielaard 2002-04-07 07:40:49 +00:00 committed by Mark Wielaard
parent 0154eaa812
commit 236fc6a041
3 changed files with 28 additions and 5 deletions

View file

@ -427,8 +427,8 @@ public class ArrayList extends AbstractList
if (csize + size > data.length)
ensureCapacity(size + csize);
int end = index + csize;
if (index != size)
System.arraycopy(data, index, data, end, csize);
if (size > 0 && index != size)
System.arraycopy(data, index, data, end, size - index);
size += csize;
for ( ; index < end; index++)
data[index] = itr.next();