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

Comparing jsr166/src/main/java/util/concurrent/CopyOnWriteArrayList.java (file contents):
Revision 1.37 by jsr166, Sat May 21 03:02:42 2005 UTC vs.
Revision 1.38 by jsr166, Sat May 21 17:32:20 2005 UTC

# Line 91 | Line 91 | public class CopyOnWriteArrayList<E>
91       *
92       * @param toCopyIn the array (a copy of this array is used as the
93       *        internal array)
94 +     * @throws NullPointerException if the specified array is null
95       */
96      public CopyOnWriteArrayList(E[] toCopyIn) {
97          copyIn(toCopyIn, 0, toCopyIn.length);
# Line 512 | Line 513 | public class CopyOnWriteArrayList<E>
513  
514      /**
515       * Append the element if not present.
516 +     *
517       * @param element element to be added to this list, if absent
518 <     * @return true if added
518 >     * @return <tt>true</tt> if the element was added
519       */
520      public synchronized boolean addIfAbsent(E element) {
521          // Copy while checking if already present.
# Line 540 | Line 542 | public class CopyOnWriteArrayList<E>
542       * @return <tt>true</tt> if this list contains all of the elements of the
543       *         specified collection
544       * @throws NullPointerException if the specified collection is null
545 +     * @see #contains(Object)
546       */
547      public boolean containsAll(Collection<?> c) {
548          E[] elementData = array();
# Line 559 | Line 562 | public class CopyOnWriteArrayList<E>
562       *
563       * @param c collection containing elements to be removed from this list
564       * @return <tt>true</tt> if this list changed as a result of the call
565 <     * @throws ClassCastException   {@inheritDoc}
566 <     * @throws NullPointerException {@inheritDoc}
565 >     * @throws ClassCastException if the class of an element of this list
566 >     *         is incompatible with the specified collection (optional)
567 >     * @throws NullPointerException if this list contains a null element and the
568 >     *         specified collection does not permit null elements (optional),
569 >     *         or if the specified collection is null
570 >     * @see #remove(Object)
571       */
572      public synchronized boolean removeAll(Collection<?> c) {
573          E[] elementData = array;
# Line 593 | Line 600 | public class CopyOnWriteArrayList<E>
600       *
601       * @param c collection containing elements to be retained in this list
602       * @return <tt>true</tt> if this list changed as a result of the call
603 <     * @throws ClassCastException   {@inheritDoc}
604 <     * @throws NullPointerException {@inheritDoc}
603 >     * @throws ClassCastException if the class of an element of this list
604 >     *         is incompatible with the specified collection (optional)
605 >     * @throws NullPointerException if this list contains a null element and the
606 >     *         specified collection does not permit null elements (optional),
607 >     *         or if the specified collection is null
608 >     * @see #remove(Object)
609       */
610      public synchronized boolean retainAll(Collection<?> c) {
611          E[] elementData = array;
# Line 627 | Line 638 | public class CopyOnWriteArrayList<E>
638       * @param c collection containing elements to be added to this list
639       * @return the number of elements added
640       * @throws NullPointerException if the specified collection is null
641 +     * @see #addIfAbsent(Object)
642       */
643      public synchronized int addAllAbsent(Collection<? extends E> c) {
644          int numNew = c.size();
# Line 658 | Line 670 | public class CopyOnWriteArrayList<E>
670  
671      /**
672       * Removes all of the elements from this list.
673 <     *
673 >     * The list will be empty after this call returns.
674       */
675      public synchronized void clear() {
676          array = (E[]) new Object[0];
# Line 670 | Line 682 | public class CopyOnWriteArrayList<E>
682       * collection's iterator.
683       *
684       * @param c collection containing elements to be added to this list
685 <     * @return true if any elements are added
685 >     * @return <tt>true</tt> if this list changed as a result of the call
686       * @throws NullPointerException if the specified collection is null
687 +     * @see #add(Object)
688       */
689      public synchronized boolean addAll(Collection<? extends E> c) {
690          int numNew = c.size();
# Line 693 | Line 706 | public class CopyOnWriteArrayList<E>
706       * list, starting at the specified position.  Shifts the element
707       * currently at that position (if any) and any subsequent elements to
708       * the right (increases their indices).  The new elements will appear
709 <     * in the list in the order that they are returned by the
710 <     * specified Collection's iterator.
709 >     * in this list in the order that they are returned by the
710 >     * specified collection's iterator.
711       *
712       * @param index index at which to insert the first element
713       *        from the specified collection
# Line 702 | Line 715 | public class CopyOnWriteArrayList<E>
715       * @return <tt>true</tt> if this list changed as a result of the call
716       * @throws IndexOutOfBoundsException {@inheritDoc}
717       * @throws NullPointerException if the specified collection is null
718 +     * @see #add(int,Object)
719       */
720      public synchronized boolean addAll(int index, Collection<? extends E> c) {
721          int len = array.length;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines