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.54 by jsr166, Sun Oct 22 17:44:03 2017 UTC vs.
Revision 1.56 by jsr166, Fri Jan 26 06:09:23 2018 UTC

# Line 1149 | Line 1149 | public class ArrayList<E> extends Abstra
1149              return modified;
1150          }
1151  
1152 +        public Object[] toArray() {
1153 +            checkForComodification();
1154 +            return Arrays.copyOfRange(root.elementData, offset, offset + size);
1155 +        }
1156 +
1157 +        @SuppressWarnings("unchecked")
1158 +        public <T> T[] toArray(T[] a) {
1159 +            checkForComodification();
1160 +            if (a.length < size)
1161 +                return (T[]) Arrays.copyOfRange(
1162 +                        root.elementData, offset, offset + size, a.getClass());
1163 +            System.arraycopy(root.elementData, offset, a, 0, size);
1164 +            if (a.length > size)
1165 +                a[size] = null;
1166 +            return a;
1167 +        }
1168 +
1169          public Iterator<E> iterator() {
1170              return listIterator();
1171          }
# Line 1556 | Line 1573 | public class ArrayList<E> extends Abstra
1573                      setBit(deathRow, i - beg);
1574              if (modCount != expectedModCount)
1575                  throw new ConcurrentModificationException();
1559            expectedModCount++;
1576              modCount++;
1577              int w = beg;
1578              for (i = beg; i < end; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines