MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / addAll

Method addAll

Ports/CLDC11/src/java/util/Vector.java:174–200  ·  view source on GitHub ↗
(int location,
            Collection<? extends E> collection)

Source from the content-addressed store, hash-verified

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

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