Hi,

another set of small fixes for
java.util.concurrent.CopyOnWriteArrayList.java

Please comment/commit.

        Thanks,
                Carsten


2006-07-22  Carsten Neumann  <[EMAIL PROTECTED]>

        * CopyOnWriteArrayList.java: Fixed some API docs.
        (serialVersionUID): New field.
        (CopyOnWriteArrayList(E[])): New constructor.
Index: java/util/concurrent/CopyOnWriteArrayList.java
===================================================================
RCS file: /sources/classpath/classpath/java/util/concurrent/Attic/CopyOnWriteArrayList.java,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 CopyOnWriteArrayList.java
--- java/util/concurrent/CopyOnWriteArrayList.java	21 Jul 2006 22:41:54 -0000	1.1.2.2
+++ java/util/concurrent/CopyOnWriteArrayList.java	22 Jul 2006 19:16:14 -0000
@@ -53,12 +53,17 @@
     List<E>, RandomAccess, Cloneable, Serializable
 {
   /**
+   * Compatible with JDK 1.5
+   */
+  private static final long serialVersionUID = 8673264195747942595L;
+
+  /**
    * Where the data is stored.
    */
   private transient E[] data;
 
   /**
-   * Construct a new ArrayList with the default capacity (16).
+   * Construct a new empty CopyOnWriteArrayList.
    */
   public CopyOnWriteArrayList()
   {
@@ -66,9 +71,9 @@
   }
 
   /**
-   * Construct a new ArrayList, and initialize it with the elements in the
-   * supplied Collection. The initial capacity is 110% of the Collection's size.
-   * 
+   * Construct a new CopyOnWriteArrayList, and initialize it with the
+   * elements in the supplied Collection.
+   *
    * @param c
    *          the collection whose elements will initialize this list
    * @throws NullPointerException
@@ -84,6 +89,18 @@
   }
 
   /**
+   * Construct a new CopyOnWriteArrayList and initialize it with the
+   * elements of the supplied array.
+   *
+   * @param arrayIn the array whose elemts will initialize this list
+   */
+  public CopyOnWriteArrayList(E[] arrayIn)
+  {
+    data = (E[]) new Object[arrayIn.length];
+    System.arraycopy(arrayIn, 0, data, 0, arrayIn.length);
+  }
+
+  /**
    * Returns the number of elements in this list.
    * 
    * @return the list size

Reply via email to