63 |
|
/** |
64 |
|
* The array buffer into which the components of the vector are |
65 |
|
* stored. The capacity of the vector is the length of this array buffer, |
66 |
< |
* and is at least large enough to contain all the vector's elements.<p> |
66 |
> |
* and is at least large enough to contain all the vector's elements. |
67 |
|
* |
68 |
< |
* Any array elements following the last element in the Vector are null. |
68 |
> |
* <p>Any array elements following the last element in the Vector are null. |
69 |
|
* |
70 |
|
* @serial |
71 |
|
*/ |
100 |
|
* @param initialCapacity the initial capacity of the vector |
101 |
|
* @param capacityIncrement the amount by which the capacity is |
102 |
|
* increased when the vector overflows |
103 |
< |
* @exception IllegalArgumentException if the specified initial capacity |
104 |
< |
* is negative |
103 |
> |
* @throws IllegalArgumentException if the specified initial capacity |
104 |
> |
* is negative |
105 |
|
*/ |
106 |
|
public Vector(int initialCapacity, int capacityIncrement) { |
107 |
|
super(); |
117 |
|
* with its capacity increment equal to zero. |
118 |
|
* |
119 |
|
* @param initialCapacity the initial capacity of the vector |
120 |
< |
* @exception IllegalArgumentException if the specified initial capacity |
121 |
< |
* is negative |
120 |
> |
* @throws IllegalArgumentException if the specified initial capacity |
121 |
> |
* is negative |
122 |
|
*/ |
123 |
|
public Vector(int initialCapacity) { |
124 |
|
this(initialCapacity, 0); |
212 |
|
* method for ensuring capacity without incurring the cost of an |
213 |
|
* extra synchronization. |
214 |
|
* |
215 |
< |
* @see java.util.Vector#ensureCapacity(int) |
215 |
> |
* @see #ensureCapacity(int) |
216 |
|
*/ |
217 |
|
private void ensureCapacityHelper(int minCapacity) { |
218 |
|
int oldCapacity = elementData.length; |
286 |
|
* then the item at index {@code 1}, and so on. |
287 |
|
* |
288 |
|
* @return an enumeration of the components of this vector |
289 |
– |
* @see Enumeration |
289 |
|
* @see Iterator |
290 |
|
*/ |
291 |
|
public Enumeration<E> elements() { |
412 |
|
} |
413 |
|
|
414 |
|
/** |
415 |
< |
* Returns the component at the specified index.<p> |
415 |
> |
* Returns the component at the specified index. |
416 |
|
* |
417 |
< |
* This method is identical in functionality to the get method |
418 |
< |
* (which is part of the List interface). |
417 |
> |
* <p>This method is identical in functionality to the {@link #get(int)} |
418 |
> |
* method (which is part of the {@link List} interface). |
419 |
|
* |
420 |
|
* @param index an index into this vector |
421 |
|
* @return the component at the specified index |
422 |
< |
* @exception ArrayIndexOutOfBoundsException if the {@code index} |
423 |
< |
* is negative or not less than the current size of this |
425 |
< |
* {@code Vector} object. |
426 |
< |
* @see #get(int) |
427 |
< |
* @see List |
422 |
> |
* @throws ArrayIndexOutOfBoundsException if the index is out of range |
423 |
> |
* ({@code index < 0 || index >= size()}) |
424 |
|
*/ |
425 |
|
public synchronized E elementAt(int index) { |
426 |
|
if (index >= elementCount) { |
435 |
|
* this vector. |
436 |
|
* |
437 |
|
* @return the first component of this vector |
438 |
< |
* @exception NoSuchElementException if this vector has no components |
438 |
> |
* @throws NoSuchElementException if this vector has no components |
439 |
|
*/ |
440 |
|
public synchronized E firstElement() { |
441 |
|
if (elementCount == 0) { |
449 |
|
* |
450 |
|
* @return the last component of the vector, i.e., the component at index |
451 |
|
* <code>size() - 1</code>. |
452 |
< |
* @exception NoSuchElementException if this vector is empty |
452 |
> |
* @throws NoSuchElementException if this vector is empty |
453 |
|
*/ |
454 |
|
public synchronized E lastElement() { |
455 |
|
if (elementCount == 0) { |
474 |
|
* |
475 |
|
* @param obj what the component is to be set to |
476 |
|
* @param index the specified index |
477 |
< |
* @exception ArrayIndexOutOfBoundsException if the index was invalid |
477 |
> |
* @throws ArrayIndexOutOfBoundsException if the index was invalid |
478 |
|
* @see #size() |
479 |
|
* @see List |
480 |
|
* @see #set(int, java.lang.Object) |
492 |
|
* this vector with an index greater or equal to the specified |
493 |
|
* {@code index} is shifted downward to have an index one |
494 |
|
* smaller than the value it had previously. The size of this vector |
495 |
< |
* is decreased by {@code 1}.<p> |
495 |
> |
* is decreased by {@code 1}. |
496 |
|
* |
497 |
< |
* The index must be a value greater than or equal to {@code 0} |
498 |
< |
* and less than the current size of the vector. <p> |
497 |
> |
* <p>The index must be a value greater than or equal to {@code 0} |
498 |
> |
* and less than the current size of the vector. |
499 |
|
* |
500 |
< |
* This method is identical in functionality to the remove method |
500 |
> |
* <p>This method is identical in functionality to the remove method |
501 |
|
* (which is part of the List interface). Note that the remove method |
502 |
|
* returns the old value that was stored at the specified position. |
503 |
|
* |
529 |
|
* specified {@code index}. Each component in this vector with |
530 |
|
* an index greater or equal to the specified {@code index} is |
531 |
|
* shifted upward to have an index one greater than the value it had |
532 |
< |
* previously. <p> |
532 |
> |
* previously. |
533 |
|
* |
534 |
< |
* The index must be a value greater than or equal to {@code 0} |
534 |
> |
* <p>The index must be a value greater than or equal to {@code 0} |
535 |
|
* and less than or equal to the current size of the vector. (If the |
536 |
|
* index is equal to the current size of the vector, the new element |
537 |
< |
* is appended to the Vector.)<p> |
537 |
> |
* is appended to the Vector.) |
538 |
|
* |
539 |
< |
* This method is identical in functionality to the add(Object, int) method |
539 |
> |
* <p>This method is identical in functionality to the add(Object, int) method |
540 |
|
* (which is part of the List interface). Note that the add method reverses |
541 |
|
* the order of the parameters, to more closely match array usage. |
542 |
|
* |