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 |
|
} |