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

Method ensureCapacity

vm/JavaAPI/src/java/util/ArrayList.java:312–323  ·  view source on GitHub ↗

Ensures that after this operation the ArrayList can hold the specified number of elements without further growing. @param minimumCapacity the minimum capacity asked for.

(int minimumCapacity)

Source from the content-addressed store, hash-verified

310 * the minimum capacity asked for.
311 */
312 public void ensureCapacity(int minimumCapacity) {
313 int required = minimumCapacity - array.length;
314 if (required > 0) {
315 // REVIEW: Why do we check the firstIndex first? Growing
316 // the end makes more sense
317 if (firstIndex > 0) {
318 growAtFront(required);
319 } else {
320 growAtEnd(required);
321 }
322 }
323 }
324
325 @Override
326 public E get(int location) {

Callers

nothing calls this directly

Calls 2

growAtFrontMethod · 0.95
growAtEndMethod · 0.95

Tested by

no test coverage detected