1245 |
|
|
1246 |
|
|
1247 |
|
private static class COWSubListIterator<E> implements ListIterator<E> { |
1248 |
< |
private final ListIterator<E> i; |
1248 |
> |
private final ListIterator<E> it; |
1249 |
|
private final int offset; |
1250 |
|
private final int size; |
1251 |
|
|
1252 |
|
COWSubListIterator(List<E> l, int index, int offset, int size) { |
1253 |
|
this.offset = offset; |
1254 |
|
this.size = size; |
1255 |
< |
i = l.listIterator(index+offset); |
1255 |
> |
it = l.listIterator(index+offset); |
1256 |
|
} |
1257 |
|
|
1258 |
|
public boolean hasNext() { |
1261 |
|
|
1262 |
|
public E next() { |
1263 |
|
if (hasNext()) |
1264 |
< |
return i.next(); |
1264 |
> |
return it.next(); |
1265 |
|
else |
1266 |
|
throw new NoSuchElementException(); |
1267 |
|
} |
1272 |
|
|
1273 |
|
public E previous() { |
1274 |
|
if (hasPrevious()) |
1275 |
< |
return i.previous(); |
1275 |
> |
return it.previous(); |
1276 |
|
else |
1277 |
|
throw new NoSuchElementException(); |
1278 |
|
} |
1279 |
|
|
1280 |
|
public int nextIndex() { |
1281 |
< |
return i.nextIndex() - offset; |
1281 |
> |
return it.nextIndex() - offset; |
1282 |
|
} |
1283 |
|
|
1284 |
|
public int previousIndex() { |
1285 |
< |
return i.previousIndex() - offset; |
1285 |
> |
return it.previousIndex() - offset; |
1286 |
|
} |
1287 |
|
|
1288 |
|
public void remove() { |