Index: src/main/org/apache/tools/ant/util/VectorSet.java =================================================================== --- src/main/org/apache/tools/ant/util/VectorSet.java (revision 1367821) +++ src/main/org/apache/tools/ant/util/VectorSet.java (working copy) @@ -105,15 +105,25 @@ * if any of them are already contained in the collection. */ public synchronized boolean addAll(int index, Collection c) { - boolean changed = false; + LinkedList toAdd = new LinkedList(); for (Iterator i = c.iterator(); i.hasNext(); ) { Object o = i.next(); - if (!set.contains(o)) { - doAdd(index++, o); - changed = true; + if (set.add(o)) { + toAdd.add(o); } } - return changed; + if (toAdd.isEmpty()) return false; + int count = size(); + ensureCapacity(count + toAdd.size()); + if (index != count) { + System.arraycopy(elementData, index, elementData, index + toAdd.size(), + count - index); + } + for (Object o : toAdd) { + elementData[index++] = o; + } + elementCount += toAdd.size(); + return true; } public synchronized void clear() {