1 |
|
/* |
2 |
< |
* %W% %E% |
2 |
> |
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. |
3 |
> |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
|
* |
5 |
< |
* Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
6 |
< |
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
5 |
> |
* This code is free software; you can redistribute it and/or modify it |
6 |
> |
* under the terms of the GNU General Public License version 2 only, as |
7 |
> |
* published by the Free Software Foundation. Sun designates this |
8 |
> |
* particular file as subject to the "Classpath" exception as provided |
9 |
> |
* by Sun in the LICENSE file that accompanied this code. |
10 |
> |
* |
11 |
> |
* This code is distributed in the hope that it will be useful, but WITHOUT |
12 |
> |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 |
> |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 |
> |
* version 2 for more details (a copy is included in the LICENSE file that |
15 |
> |
* accompanied this code). |
16 |
> |
* |
17 |
> |
* You should have received a copy of the GNU General Public License version |
18 |
> |
* 2 along with this work; if not, write to the Free Software Foundation, |
19 |
> |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
> |
* |
21 |
> |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
22 |
> |
* CA 95054 USA or visit www.sun.com if you need additional information or |
23 |
> |
* have any questions. |
24 |
|
*/ |
25 |
|
|
26 |
|
package java.util; |
268 |
|
// Iterators |
269 |
|
|
270 |
|
/** |
271 |
< |
* Returns an iterator over the elements in this list in proper |
254 |
< |
* sequence. |
271 |
> |
* Returns an iterator over the elements in this list in proper sequence. |
272 |
|
* |
273 |
|
* <p>This implementation returns a straightforward implementation of the |
274 |
|
* iterator interface, relying on the backing list's {@code size()}, |
309 |
|
* {@code ListIterator} interface that extends the implementation of the |
310 |
|
* {@code Iterator} interface returned by the {@code iterator()} method. |
311 |
|
* The {@code ListIterator} implementation relies on the backing list's |
312 |
< |
* {@code get(int)}, {@code set(int, E)}, {@code add(int, Object)} |
312 |
> |
* {@code get(int)}, {@code set(int, E)}, {@code add(int, E)} |
313 |
|
* and {@code remove(int)} methods. |
314 |
|
* |
315 |
|
* <p>Note that the list iterator returned by this implementation will |
461 |
|
* If this list implements {@code RandomAccess} the returned list will |
462 |
|
* be an instance of the subclass that implements {@code RandomAccess}. |
463 |
|
* |
464 |
< |
* <p>The subclass's {@code set(int, Object)}, {@code get(int)}, |
465 |
< |
* {@code add(int, Object)}, {@code remove(int)}, {@code addAll(int, |
464 |
> |
* <p>The subclass's {@code set(int, E)}, {@code get(int)}, |
465 |
> |
* {@code add(int, E)}, {@code remove(int)}, {@code addAll(int, |
466 |
|
* Collection)} and {@code removeRange(int, int)} methods all |
467 |
|
* delegate to the corresponding methods on the backing abstract list, |
468 |
|
* after bounds-checking the index and adjusting for the offset. The |
480 |
|
* {@code ConcurrentModificationException} if it is not. |
481 |
|
* |
482 |
|
* @throws IndexOutOfBoundsException endpoint index value out of range |
483 |
< |
* {@code (fromIndex < 0 || toIndex > size)} |
483 |
> |
* {@code (fromIndex < 0 || toIndex > size)} |
484 |
|
* @throws IllegalArgumentException if the endpoint indices are out of order |
485 |
< |
* {@code (fromIndex > toIndex)} |
485 |
> |
* {@code (fromIndex > toIndex)} |
486 |
|
*/ |
487 |
|
public List<E> subList(int fromIndex, int toIndex) { |
488 |
|
return (this instanceof RandomAccess ? |
597 |
|
* |
598 |
|
* <p><b>Use of this field by subclasses is optional.</b> If a subclass |
599 |
|
* wishes to provide fail-fast iterators (and list iterators), then it |
600 |
< |
* merely has to increment this field in its {@code add(int, Object)} and |
600 |
> |
* merely has to increment this field in its {@code add(int, E)} and |
601 |
|
* {@code remove(int)} methods (and any other methods that it overrides |
602 |
|
* that result in structural modifications to the list). A single call to |
603 |
< |
* {@code add(int, Object)} or {@code remove(int)} must add no more than |
603 |
> |
* {@code add(int, E)} or {@code remove(int)} must add no more than |
604 |
|
* one to this field, or the iterators (and list iterators) will throw |
605 |
|
* bogus {@code ConcurrentModificationExceptions}. If an implementation |
606 |
|
* does not wish to provide fail-fast iterators, this field may be |
887 |
|
fromIndex, toIndex); |
888 |
|
} |
889 |
|
} |
873 |
– |
|