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.55 by jsr166, Mon Jan 8 21:51:07 2018 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          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines