| 934 | /// if `start end` or |
| 935 | /// `end > size()`. |
| 936 | @Override |
| 937 | protected void removeRange(int start, int end) { |
| 938 | if (start >= 0 && start <= end && end <= elementCount) { |
| 939 | if (start == end) { |
| 940 | return; |
| 941 | } |
| 942 | if (end != elementCount) { |
| 943 | System.arraycopy(elementData, end, elementData, start, |
| 944 | elementCount - end); |
| 945 | int newCount = elementCount - (end - start); |
| 946 | Arrays.fill(elementData, newCount, elementCount, null); |
| 947 | elementCount = newCount; |
| 948 | } else { |
| 949 | Arrays.fill(elementData, start, elementCount, null); |
| 950 | elementCount = start; |
| 951 | } |
| 952 | modCount++; |
| 953 | } else { |
| 954 | throw new IndexOutOfBoundsException(); |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | /// Removes all objects from this vector that are not contained in the |
| 959 | /// specified collection. |