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

Comparing jsr166/src/main/java/util/ArrayList.java (file contents):
Revision 1.17 by jsr166, Sun Mar 19 17:25:10 2006 UTC vs.
Revision 1.18 by jsr166, Sun Mar 19 17:40:40 2006 UTC

# Line 167 | Line 167 | public class ArrayList<E> extends Abstra
167       * @param minCapacity the desired minimum capacity
168       */
169      private void growArray(int minCapacity) {
170 <        if (minCapacity < 0) // overflow
171 <            throw new OutOfMemoryError();
170 >        if (minCapacity < 0) // overflow
171 >            throw new OutOfMemoryError();
172          int oldCapacity = elementData.length;
173 <        // Double size if small; else grow by 50%
174 <        int newCapacity = ((oldCapacity < 64)?
175 <                           ((oldCapacity + 1) * 2):
176 <                           ((oldCapacity / 2) * 3));
177 <        if (newCapacity < 0) // overflow
178 <            newCapacity = Integer.MAX_VALUE;
179 <        if (newCapacity < minCapacity)
180 <            newCapacity = minCapacity;
181 <        elementData = Arrays.copyOf(elementData, newCapacity);
173 >        // Double size if small; else grow by 50%
174 >        int newCapacity = ((oldCapacity < 64) ?
175 >                           ((oldCapacity + 1) * 2) :
176 >                           ((oldCapacity / 2) * 3));
177 >        if (newCapacity < 0) // overflow
178 >            newCapacity = Integer.MAX_VALUE;
179 >        if (newCapacity < minCapacity)
180 >            newCapacity = minCapacity;
181 >        elementData = Arrays.copyOf(elementData, newCapacity);
182      }
183  
184      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines