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

Method growBy

Ports/CLDC11/src/java/util/Vector.java:502–520  ·  view source on GitHub ↗
(int required)

Source from the content-addressed store, hash-verified

500 }
501
502 private void growBy(int required) {
503 int adding = 0;
504 if (capacityIncrement <= 0) {
505 if ((adding = elementData.length) == 0) {
506 adding = required;
507 }
508 while (adding < required) {
509 adding += adding;
510 }
511 } else {
512 adding = (required / capacityIncrement) * capacityIncrement;
513 if (adding < required) {
514 adding += capacityIncrement;
515 }
516 }
517 E[] newData = newElementArray(elementData.length + adding);
518 System.arraycopy(elementData, 0, newData, 0, elementCount);
519 elementData = newData;
520 }
521
522 /// Returns an integer hash code for the receiver. Objects which are equal
523 /// return the same value for this method.

Callers 1

addAllMethod · 0.95

Calls 2

newElementArrayMethod · 0.95
arraycopyMethod · 0.95

Tested by

no test coverage detected