250 |
|
// Iterators |
251 |
|
|
252 |
|
/** |
253 |
< |
* Returns an iterator over the elements in this list in proper |
254 |
< |
* sequence. |
253 |
> |
* Returns an iterator over the elements in this list in proper sequence. |
254 |
|
* |
255 |
|
* <p>This implementation returns a straightforward implementation of the |
256 |
|
* iterator interface, relying on the backing list's {@code size()}, |
291 |
|
* {@code ListIterator} interface that extends the implementation of the |
292 |
|
* {@code Iterator} interface returned by the {@code iterator()} method. |
293 |
|
* The {@code ListIterator} implementation relies on the backing list's |
294 |
< |
* {@code get(int)}, {@code set(int, E)}, {@code add(int, Object)} |
294 |
> |
* {@code get(int)}, {@code set(int, E)}, {@code add(int, E)} |
295 |
|
* and {@code remove(int)} methods. |
296 |
|
* |
297 |
|
* <p>Note that the list iterator returned by this implementation will |
443 |
|
* If this list implements {@code RandomAccess} the returned list will |
444 |
|
* be an instance of the subclass that implements {@code RandomAccess}. |
445 |
|
* |
446 |
< |
* <p>The subclass's {@code set(int, Object)}, {@code get(int)}, |
447 |
< |
* {@code add(int, Object)}, {@code remove(int)}, {@code addAll(int, |
446 |
> |
* <p>The subclass's {@code set(int, E)}, {@code get(int)}, |
447 |
> |
* {@code add(int, E)}, {@code remove(int)}, {@code addAll(int, |
448 |
|
* Collection)} and {@code removeRange(int, int)} methods all |
449 |
|
* delegate to the corresponding methods on the backing abstract list, |
450 |
|
* after bounds-checking the index and adjusting for the offset. The |
462 |
|
* {@code ConcurrentModificationException} if it is not. |
463 |
|
* |
464 |
|
* @throws IndexOutOfBoundsException endpoint index value out of range |
465 |
< |
* {@code (fromIndex < 0 || toIndex > size)} |
465 |
> |
* {@code (fromIndex < 0 || toIndex > size)} |
466 |
|
* @throws IllegalArgumentException if the endpoint indices are out of order |
467 |
< |
* {@code (fromIndex > toIndex)} |
467 |
> |
* {@code (fromIndex > toIndex)} |
468 |
|
*/ |
469 |
|
public List<E> subList(int fromIndex, int toIndex) { |
470 |
|
return (this instanceof RandomAccess ? |
579 |
|
* |
580 |
|
* <p><b>Use of this field by subclasses is optional.</b> If a subclass |
581 |
|
* wishes to provide fail-fast iterators (and list iterators), then it |
582 |
< |
* merely has to increment this field in its {@code add(int, Object)} and |
582 |
> |
* merely has to increment this field in its {@code add(int, E)} and |
583 |
|
* {@code remove(int)} methods (and any other methods that it overrides |
584 |
|
* that result in structural modifications to the list). A single call to |
585 |
< |
* {@code add(int, Object)} or {@code remove(int)} must add no more than |
585 |
> |
* {@code add(int, E)} or {@code remove(int)} must add no more than |
586 |
|
* one to this field, or the iterators (and list iterators) will throw |
587 |
|
* bogus {@code ConcurrentModificationExceptions}. If an implementation |
588 |
|
* does not wish to provide fail-fast iterators, this field may be |