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

Method removeRange

vm/JavaAPI/src/java/util/Vector.java:798–818  ·  view source on GitHub ↗

Removes the objects in the specified range from the start to the, but not including, end index. All elements with an index bigger than or equal to end have their index decreased by end - start. @param start the index at which to start removing. @param end the i

(int start, int end)

Source from the content-addressed store, hash-verified

796 * {@code end > size()}.
797 */
798 @Override
799 protected void removeRange(int start, int end) {
800 if (start >= 0 && start <= end && end <= elementCount) {
801 if (start == end) {
802 return;
803 }
804 if (end != elementCount) {
805 System.arraycopy(elementData, end, elementData, start,
806 elementCount - end);
807 int newCount = elementCount - (end - start);
808 Arrays.fill(elementData, newCount, elementCount, null);
809 elementCount = newCount;
810 } else {
811 Arrays.fill(elementData, start, elementCount, null);
812 elementCount = start;
813 }
814 modCount++;
815 } else {
816 throw new IndexOutOfBoundsException();
817 }
818 }
819
820 /**
821 * Removes all objects from this vector that are not contained in the

Callers

nothing calls this directly

Calls 2

arraycopyMethod · 0.95
fillMethod · 0.95

Tested by

no test coverage detected