MCPcopy Create free account
hub / github.com/davidgiven/luje / addAll

Method addAll

lib/java/util/Vector.java:175–201  ·  view source on GitHub ↗

Inserts the objects in the specified collection at the specified location in this vector. The objects are inserted in the order in which they are returned from the Collection iterator. The elements with an index equal or higher than location have their index increased by the size of the adde

(int location,
            Collection<? extends E> collection)

Source from the content-addressed store, hash-verified

173 * if {@code location < 0} or {@code location > size()}.
174 */
175 @Override
176 public synchronized boolean addAll(int location,
177 Collection<? extends E> collection) {
178 if (0 <= location && location <= elementCount) {
179 int size = collection.size();
180 if (size == 0) {
181 return false;
182 }
183 int required = size - (elementData.length - elementCount);
184 if (required > 0) {
185 growBy(required);
186 }
187 int count = elementCount - location;
188 if (count > 0) {
189 System.arraycopy(elementData, location, elementData, location
190 + size, count);
191 }
192 Iterator<? extends E> it = collection.iterator();
193 while (it.hasNext()) {
194 elementData[location++] = it.next();
195 }
196 elementCount += size;
197 modCount++;
198 return true;
199 }
200 throw new ArrayIndexOutOfBoundsException(location);
201 }
202
203 /**
204 * Adds the objects in the specified collection to the end of this vector.

Callers

nothing calls this directly

Calls 6

growByMethod · 0.95
arraycopyMethod · 0.95
sizeMethod · 0.65
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected