Sets the size of this vector to the specified size. If there are more than length elements in this vector, the elements at end are lost. If there are less than length elements in the vector, the additional elements contain null. @param length the new size of this vector. @see #size
(int length)
| 911 | * @see #size |
| 912 | */ |
| 913 | public synchronized void setSize(int length) { |
| 914 | if (length == elementCount) { |
| 915 | return; |
| 916 | } |
| 917 | ensureCapacity(length); |
| 918 | if (elementCount > length) { |
| 919 | Arrays.fill(elementData, length, elementCount, null); |
| 920 | } |
| 921 | elementCount = length; |
| 922 | modCount++; |
| 923 | } |
| 924 | |
| 925 | /** |
| 926 | * Returns the number of elements in this vector. |
nothing calls this directly
no test coverage detected