ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/Vector.java
(Generate patch)

Comparing jsr166/src/main/java/util/Vector.java (file contents):
Revision 1.14 by jsr166, Sun Jun 25 19:41:52 2006 UTC vs.
Revision 1.16 by jsr166, Sun Jun 25 20:05:33 2006 UTC

# Line 63 | Line 63 | public class Vector<E>
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       */
# Line 100 | Line 100 | public class Vector<E>
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();
# Line 117 | Line 117 | public class Vector<E>
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);
# Line 212 | Line 212 | public class Vector<E>
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;
# Line 233 | Line 233 | public class Vector<E>
233       * the vector. If the new size is less than the current size, all
234       * components at index {@code newSize} and greater are discarded.
235       *
236 <     * @param   newSize   the new size of this vector
237 <     * @throws  ArrayIndexOutOfBoundsException if new size is negative
236 >     * @param  newSize   the new size of this vector
237 >     * @throws ArrayIndexOutOfBoundsException if the new size is negative
238       */
239      public synchronized void setSize(int newSize) {
240          modCount++;
# Line 286 | Line 286 | public class Vector<E>
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() {
# Line 413 | Line 412 | public class Vector<E>
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) {
# Line 439 | Line 435 | public class Vector<E>
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) {
# Line 453 | Line 449 | public class Vector<E>
449       *
450       * @return  the last component of the vector, i.e., the component at index
451       *          <code>size()&nbsp;-&nbsp;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) {
# Line 465 | Line 461 | public class Vector<E>
461      /**
462       * Sets the component at the specified {@code index} of this
463       * vector to be the specified object. The previous component at that
464 <     * position is discarded.<p>
464 >     * position is discarded.
465       *
466 <     * The index must be a value greater than or equal to {@code 0}
467 <     * and less than the current size of the vector. <p>
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 <     * This method is identical in functionality to the set method
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
# Line 478 | Line 474 | public class Vector<E>
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)
# Line 496 | Line 492 | public class Vector<E>
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       *
# Line 533 | Line 529 | public class Vector<E>
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       *
# Line 566 | Line 562 | public class Vector<E>
562      /**
563       * Adds the specified component to the end of this vector,
564       * increasing its size by one. The capacity of this vector is
565 <     * increased if its size becomes greater than its capacity. <p>
565 >     * increased if its size becomes greater than its capacity.
566       *
567 <     * This method is identical in functionality to the add(Object) method
567 >     * <p>This method is identical in functionality to the add(Object) method
568       * (which is part of the List interface).
569       *
570       * @param   obj   the component to be added
# Line 586 | Line 582 | public class Vector<E>
582       * from this vector. If the object is found in this vector, each
583       * component in the vector with an index greater or equal to the
584       * object's index is shifted downward to have an index one smaller
585 <     * than the value it had previously.<p>
585 >     * than the value it had previously.
586       *
587 <     * This method is identical in functionality to the remove(Object)
587 >     * <p>This method is identical in functionality to the remove(Object)
588       * method (which is part of the List interface).
589       *
590       * @param   obj   the component to be removed
# Line 659 | Line 655 | public class Vector<E>
655       * correct order; the runtime type of the returned array is that of the
656       * specified array.  If the Vector fits in the specified array, it is
657       * returned therein.  Otherwise, a new array is allocated with the runtime
658 <     * type of the specified array and the size of this Vector.<p>
658 >     * type of the specified array and the size of this Vector.
659       *
660 <     * If the Vector fits in the specified array with room to spare
660 >     * <p>If the Vector fits in the specified array with room to spare
661       * (i.e., the array has more elements than the Vector),
662       * the element in the array immediately following the end of the
663       * Vector is set to null.  (This is useful in determining the length
# Line 672 | Line 668 | public class Vector<E>
668       *          be stored, if it is big enough; otherwise, a new array of the
669       *          same runtime type is allocated for this purpose.
670       * @return an array containing the elements of the Vector
671 <     * @exception ArrayStoreException the runtime type of a is not a supertype
671 >     * @throws ArrayStoreException the runtime type of a is not a supertype
672       * of the runtime type of every element in this Vector
673       * @throws NullPointerException if the given array is null
674       * @since 1.2
# Line 1149 | Line 1145 | public class Vector<E>
1145       * equal, the returned List is empty.)  The returned List is backed by this
1146       * List, so changes in the returned List are reflected in this List, and
1147       * vice-versa.  The returned List supports all of the optional List
1148 <     * operations supported by this List.<p>
1148 >     * operations supported by this List.
1149       *
1150 <     * This method eliminates the need for explicit range operations (of
1150 >     * <p>This method eliminates the need for explicit range operations (of
1151       * the sort that commonly exist for arrays).   Any operation that expects
1152       * a List can be used as a range operation by operating on a subList view
1153       * instead of a whole List.  For example, the following idiom
# Line 1161 | Line 1157 | public class Vector<E>
1157       * </pre>
1158       * Similar idioms may be constructed for indexOf and lastIndexOf,
1159       * and all of the algorithms in the Collections class can be applied to
1160 <     * a subList.<p>
1160 >     * a subList.
1161       *
1162 <     * The semantics of the List returned by this method become undefined if
1162 >     * <p>The semantics of the List returned by this method become undefined if
1163       * the backing list (i.e., this List) is <i>structurally modified</i> in
1164       * any way other than via the returned List.  (Structural modifications are
1165       * those that change the size of the List, or otherwise perturb it in such

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines