/[classpath]/classpath/java/util/Vector.java
ViewVC logotype

Diff of /classpath/java/util/Vector.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20.2.2 by tromey, Sun Aug 8 06:38:26 2004 UTC revision 1.20.2.3 by tromey, Wed Jan 12 01:12:48 2005 UTC
# Line 129  public class Vector<T> extends AbstractL Line 129  public class Vector<T> extends AbstractL
129    public Vector(Collection<? extends T> c)    public Vector(Collection<? extends T> c)
130    {    {
131      elementCount = c.size();      elementCount = c.size();
132      elementData = c.toArray(new T[elementCount]);      elementData = c.toArray((T[]) new Object[elementCount]);
133    }    }
134    
135    /**    /**
# Line 145  public class Vector<T> extends AbstractL Line 145  public class Vector<T> extends AbstractL
145    {    {
146      if (initialCapacity < 0)      if (initialCapacity < 0)
147        throw new IllegalArgumentException();        throw new IllegalArgumentException();
148      elementData = new T[initialCapacity];      elementData = (T[]) new Object[initialCapacity];
149      this.capacityIncrement = capacityIncrement;      this.capacityIncrement = capacityIncrement;
150    }    }
151    
# Line 188  public class Vector<T> extends AbstractL Line 188  public class Vector<T> extends AbstractL
188      // vector since that is a much less likely case; it's more efficient to      // vector since that is a much less likely case; it's more efficient to
189      // not do the check and lose a bit of performance in that infrequent case      // not do the check and lose a bit of performance in that infrequent case
190    
191      T[] newArray = new T[elementCount];      T[] newArray = (T[]) new Object[elementCount];
192      System.arraycopy(elementData, 0, newArray, 0, elementCount);      System.arraycopy(elementData, 0, newArray, 0, elementCount);
193      elementData = newArray;      elementData = newArray;
194    }    }
# Line 214  public class Vector<T> extends AbstractL Line 214  public class Vector<T> extends AbstractL
214      else      else
215        newCapacity = elementData.length + capacityIncrement;        newCapacity = elementData.length + capacityIncrement;
216    
217      T[] newArray = new T[Math.max(newCapacity, minCapacity)];      T[] newArray = (T[]) new Object[Math.max(newCapacity, minCapacity)];
218    
219      System.arraycopy(elementData, 0, newArray, 0, elementCount);      System.arraycopy(elementData, 0, newArray, 0, elementCount);
220      elementData = newArray;      elementData = newArray;
# Line 778  public class Vector<T> extends AbstractL Line 778  public class Vector<T> extends AbstractL
778    public synchronized boolean addAll(int index, Collection<? extends T> c)    public synchronized boolean addAll(int index, Collection<? extends T> c)
779    {    {
780      checkBoundInclusive(index);      checkBoundInclusive(index);
781      Iterator itr = c.iterator();      Iterator<? extends T> itr = c.iterator();
782      int csize = c.size();      int csize = c.size();
783    
784      modCount++;      modCount++;

Legend:
Removed from v.1.20.2.2  
changed lines
  Added in v.1.20.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26