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

Diff of /classpath/java/util/ArrayList.java

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

revision 1.25.2.1 by tromey, Sun Aug 15 07:59:51 2004 UTC revision 1.25.2.2 by tromey, Wed Jan 12 01:12:48 2005 UTC
# Line 116  public class ArrayList<E> extends Abstra Line 116  public class ArrayList<E> extends Abstra
116      // Must explicitly check, to get correct exception.      // Must explicitly check, to get correct exception.
117      if (capacity < 0)      if (capacity < 0)
118        throw new IllegalArgumentException();        throw new IllegalArgumentException();
119      data = new E[capacity];      data = (E[]) new Object[capacity];
120    }    }
121    
122    /**    /**
# Line 151  public class ArrayList<E> extends Abstra Line 151  public class ArrayList<E> extends Abstra
151      // so don't update modCount.      // so don't update modCount.
152      if (size != data.length)      if (size != data.length)
153        {        {
154          E[] newData = new E[size];          E[] newData = (E[]) new Object[size];
155          System.arraycopy(data, 0, newData, 0, size);          System.arraycopy(data, 0, newData, 0, size);
156          data = newData;          data = newData;
157        }        }
# Line 173  public class ArrayList<E> extends Abstra Line 173  public class ArrayList<E> extends Abstra
173    
174      if (minCapacity > current)      if (minCapacity > current)
175        {        {
176          E[] newData = new E[Math.max(current * 2, minCapacity)];          E[] newData = (E[]) new Object[Math.max(current * 2, minCapacity)];
177          System.arraycopy(data, 0, newData, 0, size);          System.arraycopy(data, 0, newData, 0, size);
178          data = newData;          data = newData;
179        }        }
# Line 268  public class ArrayList<E> extends Abstra Line 268  public class ArrayList<E> extends Abstra
268     */     */
269    public Object[] toArray()    public Object[] toArray()
270    {    {
271      E[] array = new E[size];      E[] array = (E[]) new Object[size];
272      System.arraycopy(data, 0, array, 0, size);      System.arraycopy(data, 0, array, 0, size);
273      return array;      return array;
274    }    }
# Line 578  public class ArrayList<E> extends Abstra Line 578  public class ArrayList<E> extends Abstra
578      // the `size' field.      // the `size' field.
579      s.defaultReadObject();      s.defaultReadObject();
580      int capacity = s.readInt();      int capacity = s.readInt();
581      data = new E[capacity];      data = (E[]) new Object[capacity];
582      for (int i = 0; i < size; i++)      for (int i = 0; i < size; i++)
583        data[i] = (E) s.readObject();        data[i] = (E) s.readObject();
584    }    }

Legend:
Removed from v.1.25.2.1  
changed lines
  Added in v.1.25.2.2

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