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.59 by jsr166, Wed Sep 28 02:16:52 2005 UTC vs.
Revision 1.60 by jsr166, Sat Oct 1 22:09:39 2005 UTC

# Line 67 | Line 67 | public class CopyOnWriteArrayList<E>
67      private volatile transient Object[] array;
68  
69      /**
70 <     * Get the array. Non-private so as to also be accessible
71 <     * from CopyOnWriteArraySet class
70 >     * Gets the array.  Non-private so as to also be accessible
71 >     * from CopyOnWriteArraySet class.
72       */
73      final Object[]  getArray() {
74          return array;
75      }
76  
77      /**
78 <     * Set the array
78 >     * Sets the array.
79       */
80      final void setArray(Object[] a) {
81          array = a;
# Line 873 | Line 873 | public class CopyOnWriteArrayList<E>
873  
874      /**
875       * Compares the specified object with this list for equality.
876 <     * Returns true if the specified object is the same object as this
877 <     * object, or if it is also a {@link List}, and every element of
878 <     * the specified list, as revealed by a single traversal of its
879 <     * <tt>iterator()</tt>, is also present in the same position of
880 <     * this list at the point of call of this method, and no other
881 <     * elements not present in the given list are contained in this
882 <     * list.
876 >     * Returns {@code true} if the specified object is the same object
877 >     * as this object, or if it is also a {@link List} and the sequence
878 >     * of elements returned by an {@linkplain List#iterator() iterator}
879 >     * over the specified list is the same as the sequence returned by
880 >     * an iterator over this list.  The two sequences are considered to
881 >     * be the same if they have the same length and corresponding
882 >     * elements at the same position in the sequence are <em>equal</em>.
883 >     * Two elements {@code e1} and {@code e2} are considered
884 >     * <em>equal</em> if {@code (e1==null ? e2==null : e1.equals(e2))}.
885       *
886       * @param o the object to be compared for equality with this list
887 <     * @return <tt>true</tt> if the specified object is equal to this list
887 >     * @return {@code true} if the specified object is equal to this list
888       */
889      public boolean equals(Object o) {
890          if (o == this)
# Line 891 | Line 893 | public class CopyOnWriteArrayList<E>
893              return false;
894  
895          List<?> list = (List<?>)(o);
896 <        Iterator<?> listIt = list.listIterator();
896 >        Iterator<?> it = list.iterator();
897          Object[] elements = getArray();
898          int len = elements.length;
899 <        for (int i = 0; i < len; ++i) {
900 <            if (!listIt.hasNext() || !eq(elements[i], listIt.next()))
899 >        for (int i = 0; i < len; ++i)
900 >            if (!it.hasNext() || !eq(elements[i], it.next()))
901                  return false;
902 <        }
901 <        if (listIt.hasNext())
902 >        if (it.hasNext())
903              return false;
904          return true;
905      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines