1139 |
|
this.parent = parent; |
1140 |
|
this.offset = parent.offset + fromIndex; |
1141 |
|
this.size = toIndex - fromIndex; |
1142 |
< |
this.modCount = root.modCount; |
1142 |
> |
this.modCount = parent.modCount; |
1143 |
|
} |
1144 |
|
|
1145 |
|
public E set(int index, E element) { |
1292 |
|
return new ListIterator<E>() { |
1293 |
|
int cursor = index; |
1294 |
|
int lastRet = -1; |
1295 |
< |
int expectedModCount = root.modCount; |
1295 |
> |
int expectedModCount = SubList.this.modCount; |
1296 |
|
|
1297 |
|
public boolean hasNext() { |
1298 |
|
return cursor != SubList.this.size; |
1336 |
|
final Object[] es = root.elementData; |
1337 |
|
if (offset + i >= es.length) |
1338 |
|
throw new ConcurrentModificationException(); |
1339 |
< |
for (; i < size && modCount == expectedModCount; i++) |
1339 |
> |
for (; i < size && root.modCount == expectedModCount; i++) |
1340 |
|
action.accept(elementAt(es, offset + i)); |
1341 |
|
// update once at end to reduce heap write traffic |
1342 |
|
cursor = i; |
1362 |
|
SubList.this.remove(lastRet); |
1363 |
|
cursor = lastRet; |
1364 |
|
lastRet = -1; |
1365 |
< |
expectedModCount = root.modCount; |
1365 |
> |
expectedModCount = SubList.this.modCount; |
1366 |
|
} catch (IndexOutOfBoundsException ex) { |
1367 |
|
throw new ConcurrentModificationException(); |
1368 |
|
} |
1388 |
|
SubList.this.add(i, e); |
1389 |
|
cursor = i + 1; |
1390 |
|
lastRet = -1; |
1391 |
< |
expectedModCount = root.modCount; |
1391 |
> |
expectedModCount = SubList.this.modCount; |
1392 |
|
} catch (IndexOutOfBoundsException ex) { |
1393 |
|
throw new ConcurrentModificationException(); |
1394 |
|
} |