You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2008/09/15 18:47:39 UTC

svn commit: r695544 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util: ArrayList.java Vector.java

Author: tellison
Date: Mon Sep 15 09:47:38 2008
New Revision: 695544

URL: http://svn.apache.org/viewvc?rev=695544&view=rev
Log:
Simplify - no functional change.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java?rev=695544&r1=695543&r2=695544&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java Mon Sep 15 09:47:38 2008
@@ -56,12 +56,11 @@
      *            the initial capacity of this ArrayList
      */
     public ArrayList(int capacity) {
-        firstIndex = lastIndex = 0;
-        try {
-            array = newElementArray(capacity);
-        } catch (NegativeArraySizeException e) {
+        if (capacity < 0) {
             throw new IllegalArgumentException();
         }
+        firstIndex = lastIndex = 0;
+        array = newElementArray(capacity);
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java?rev=695544&r1=695543&r2=695544&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Vector.java Mon Sep 15 09:47:38 2008
@@ -88,12 +88,11 @@
      *            the amount to increase the capacity when this Vector is full
      */
     public Vector(int capacity, int capacityIncrement) {
-        elementCount = 0;
-        try {
-            elementData = newElementArray(capacity);
-        } catch (NegativeArraySizeException e) {
+        if (capacity < 0) {
             throw new IllegalArgumentException();
         }
+        elementData = newElementArray(capacity);
+        elementCount = 0;
         this.capacityIncrement = capacityIncrement;
     }
 
@@ -760,7 +759,9 @@
      * @see #size
      */
     public synchronized void removeAllElements() {
-        Arrays.fill(elementData, 0, elementCount, null);
+        for (int i = 0; i < elementCount; i++) {
+            elementData[i] = null;
+        }
         modCount++;
         elementCount = 0;
     }