>diff -u classpath/java/util/Vector.java classpath/java/util/new/Vector.java
>--- classpath/java/util/Vector.java Fri Nov 13 16:40:34 1998
>+++ classpath/java/util/new/Vector.java Sat Nov 14 12:59:45 1998
>@@ -453,7 +453,14 @@
>    * Creates a new Vector with the same contents as this one.
>    */
>   public Object clone() {
>-    return new Vector(this);
>+    try {
>+      Vector clone = (Vector) super.clone();
>+      clone.elementData = new Object[elementCount];
>+      System.arraycopy(elementData, 0, clone.elementData, 0,
elementCount);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I think,

clone.elementData = elementData.clone();

should be _much_ faster.
I think that sources with manual clonig of arrays were written before arrays
become
to implement Cloneable... What else may be the reason? ;-)

>+      return clone;
>+    } catch (CloneNotSupportedException ex) {
>+      return null;
>+    }
>   }
>
>   /**

Reply via email to