Inserts the specified object into this vector at the specified location. This object is inserted before any previous element at the specified location. All elements with an index equal or greater than location have their index increased by 1. If the location is equal to the size of this vect
(E object, int location)
| 550 | * @see #size |
| 551 | */ |
| 552 | public synchronized void insertElementAt(E object, int location) { |
| 553 | if (0 <= location && location <= elementCount) { |
| 554 | if (elementCount == elementData.length) { |
| 555 | growByOne(); |
| 556 | } |
| 557 | int count = elementCount - location; |
| 558 | if (count > 0) { |
| 559 | System.arraycopy(elementData, location, elementData, |
| 560 | location + 1, count); |
| 561 | } |
| 562 | elementData[location] = object; |
| 563 | elementCount++; |
| 564 | modCount++; |
| 565 | } else { |
| 566 | throw new ArrayIndexOutOfBoundsException(location); |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | /** |
| 571 | * Returns if this vector has no elements, a size of zero. |
no test coverage detected