466 |
|
* <p>The index must be a value greater than or equal to {@code 0} |
467 |
|
* and less than the current size of the vector. |
468 |
|
* |
469 |
< |
* <p>This method is identical in functionality to the set method |
470 |
< |
* (which is part of the List interface). Note that the set method reverses |
471 |
< |
* the order of the parameters, to more closely match array usage. Note |
472 |
< |
* also that the set method returns the old value that was stored at the |
473 |
< |
* specified position. |
469 |
> |
* <p>This method is identical in functionality to the |
470 |
> |
* {@link #set(int, Object) set(int, E)} |
471 |
> |
* method (which is part of the {@link List} interface). Note that the |
472 |
> |
* {@code set} method reverses the order of the parameters, to more closely |
473 |
> |
* match array usage. Note also that the {@code set} method returns the |
474 |
> |
* old value that was stored at the specified position. |
475 |
|
* |
476 |
|
* @param obj what the component is to be set to |
477 |
|
* @param index the specified index |
478 |
< |
* @throws ArrayIndexOutOfBoundsException if the index was invalid |
479 |
< |
* @see #size() |
479 |
< |
* @see List |
480 |
< |
* @see #set(int, java.lang.Object) |
478 |
> |
* @throws ArrayIndexOutOfBoundsException if the index is out of range |
479 |
> |
* ({@code index < 0 || index >= size()}) |
480 |
|
*/ |
481 |
|
public synchronized void setElementAt(E obj, int index) { |
482 |
|
if (index >= elementCount) { |
496 |
|
* <p>The index must be a value greater than or equal to {@code 0} |
497 |
|
* and less than the current size of the vector. |
498 |
|
* |
499 |
< |
* <p>This method is identical in functionality to the remove method |
500 |
< |
* (which is part of the List interface). Note that the remove method |
501 |
< |
* returns the old value that was stored at the specified position. |
499 |
> |
* <p>This method is identical in functionality to the {@link #remove(int)} |
500 |
> |
* method (which is part of the {@link List} interface). Note that the |
501 |
> |
* {@code remove} method returns the old value that was stored at the |
502 |
> |
* specified position. |
503 |
|
* |
504 |
|
* @param index the index of the object to remove |
505 |
< |
* @exception ArrayIndexOutOfBoundsException if the index was invalid |
506 |
< |
* @see #size() |
507 |
< |
* @see #remove(int) |
508 |
< |
* @see List |
505 |
> |
* @throws ArrayIndexOutOfBoundsException if the index is out of range |
506 |
> |
* ({@code index < 0 || index >= size()}) |
507 |
|
*/ |
508 |
|
public synchronized void removeElementAt(int index) { |
509 |
|
modCount++; |
534 |
|
* index is equal to the current size of the vector, the new element |
535 |
|
* is appended to the Vector.) |
536 |
|
* |
537 |
< |
* <p>This method is identical in functionality to the add(Object, int) method |
538 |
< |
* (which is part of the List interface). Note that the add method reverses |
539 |
< |
* the order of the parameters, to more closely match array usage. |
537 |
> |
* <p>This method is identical in functionality to the |
538 |
> |
* {@link #add(int, Object) add(int, E)} |
539 |
> |
* method (which is part of the {@link List} interface). Note that the |
540 |
> |
* {@code add} method reverses the order of the parameters, to more closely |
541 |
> |
* match array usage. |
542 |
|
* |
543 |
|
* @param obj the component to insert |
544 |
|
* @param index where to insert the new component |
545 |
< |
* @exception ArrayIndexOutOfBoundsException if the index was invalid |
546 |
< |
* @see #size() |
547 |
< |
* @see #add(int, Object) |
548 |
< |
* @see List |
545 |
> |
* @throws ArrayIndexOutOfBoundsException if the index is out of range |
546 |
> |
* ({@code index < 0 || index > size()}) |
547 |
|
*/ |
548 |
|
public synchronized void insertElementAt(E obj, int index) { |
549 |
|
modCount++; |
562 |
|
* increasing its size by one. The capacity of this vector is |
563 |
|
* increased if its size becomes greater than its capacity. |
564 |
|
* |
565 |
< |
* <p>This method is identical in functionality to the add(Object) method |
566 |
< |
* (which is part of the List interface). |
565 |
> |
* <p>This method is identical in functionality to the |
566 |
> |
* {@link #remove(Object)} method (which is part of the |
567 |
> |
* {@link List} interface). |
568 |
|
* |
569 |
|
* @param obj the component to be added |
571 |
– |
* @see #add(Object) |
572 |
– |
* @see List |
570 |
|
*/ |
571 |
|
public synchronized void addElement(E obj) { |
572 |
|
modCount++; |
601 |
|
} |
602 |
|
|
603 |
|
/** |
604 |
< |
* Removes all components from this vector and sets its size to zero.<p> |
604 |
> |
* Removes all components from this vector and sets its size to zero. |
605 |
|
* |
606 |
< |
* This method is identical in functionality to the clear method |
607 |
< |
* (which is part of the List interface). |
611 |
< |
* |
612 |
< |
* @see #clear |
613 |
< |
* @see List |
606 |
> |
* <p>This method is identical in functionality to the {@link #clear} |
607 |
> |
* method (which is part of the {@link List} interface). |
608 |
|
*/ |
609 |
|
public synchronized void removeAllElements() { |
610 |
|
modCount++; |
662 |
|
* be stored, if it is big enough; otherwise, a new array of the |
663 |
|
* same runtime type is allocated for this purpose. |
664 |
|
* @return an array containing the elements of the Vector |
665 |
< |
* @throws ArrayStoreException the runtime type of a is not a supertype |
665 |
> |
* @throws ArrayStoreException if the runtime type of a is not a supertype |
666 |
|
* of the runtime type of every element in this Vector |
667 |
|
* @throws NullPointerException if the given array is null |
668 |
|
* @since 1.2 |
686 |
|
* |
687 |
|
* @param index index of the element to return |
688 |
|
* @return object at the specified index |
689 |
< |
* @exception ArrayIndexOutOfBoundsException index is out of range (index |
690 |
< |
* < 0 || index >= size()) |
689 |
> |
* @throws ArrayIndexOutOfBoundsException if the index is out of range |
690 |
> |
* ({@code index < 0 || index >= size()}) |
691 |
|
* @since 1.2 |
692 |
|
*/ |
693 |
|
public synchronized E get(int index) { |
704 |
|
* @param index index of the element to replace |
705 |
|
* @param element element to be stored at the specified position |
706 |
|
* @return the element previously at the specified position |
707 |
< |
* @exception ArrayIndexOutOfBoundsException index out of range |
708 |
< |
* (index < 0 || index >= size()) |
707 |
> |
* @throws ArrayIndexOutOfBoundsException if the index is out of range |
708 |
> |
* ({@code index < 0 || index >= size()}) |
709 |
|
* @since 1.2 |
710 |
|
*/ |
711 |
|
public synchronized E set(int index, E element) { |
753 |
|
* |
754 |
|
* @param index index at which the specified element is to be inserted |
755 |
|
* @param element element to be inserted |
756 |
< |
* @exception ArrayIndexOutOfBoundsException index is out of range |
757 |
< |
* (index < 0 || index > size()) |
756 |
> |
* @throws ArrayIndexOutOfBoundsException if the index is out of range |
757 |
> |
* ({@code index < 0 || index > size()}) |
758 |
|
* @since 1.2 |
759 |
|
*/ |
760 |
|
public void add(int index, E element) { |