src/java.base/share/classes/java/util/ArrayList.java
changeset 48686 e3dcdd73a549
parent 48541 946e34c2dec9
child 49433 b6671a111395
equal deleted inserted replaced
48685:f13f9b941bc7 48686:e3dcdd73a549
  1141             if (modified)
  1141             if (modified)
  1142                 updateSizeAndModCount(root.size - oldSize);
  1142                 updateSizeAndModCount(root.size - oldSize);
  1143             return modified;
  1143             return modified;
  1144         }
  1144         }
  1145 
  1145 
       
  1146         public Object[] toArray() {
       
  1147             checkForComodification();
       
  1148             return Arrays.copyOfRange(root.elementData, offset, offset + size);
       
  1149         }
       
  1150 
       
  1151         @SuppressWarnings("unchecked")
       
  1152         public <T> T[] toArray(T[] a) {
       
  1153             checkForComodification();
       
  1154             if (a.length < size)
       
  1155                 return (T[]) Arrays.copyOfRange(
       
  1156                         root.elementData, offset, offset + size, a.getClass());
       
  1157             System.arraycopy(root.elementData, offset, a, 0, size);
       
  1158             if (a.length > size)
       
  1159                 a[size] = null;
       
  1160             return a;
       
  1161         }
       
  1162 
  1146         public Iterator<E> iterator() {
  1163         public Iterator<E> iterator() {
  1147             return listIterator();
  1164             return listIterator();
  1148         }
  1165         }
  1149 
  1166 
  1150         public ListIterator<E> listIterator(int index) {
  1167         public ListIterator<E> listIterator(int index) {