617 |
|
int length; // Number of elements in this sublist |
618 |
|
|
619 |
|
SubList(AbstractList<E> base, |
620 |
< |
AbstractList<E> parent, |
621 |
< |
int baseIndex, |
622 |
< |
int fromIndex, |
620 |
> |
AbstractList<E> parent, |
621 |
> |
int baseIndex, |
622 |
> |
int fromIndex, |
623 |
|
int toIndex) { |
624 |
|
if (fromIndex < 0) |
625 |
|
throw new IndexOutOfBoundsException("fromIndex = " + fromIndex); |
640 |
|
* Returns an IndexOutOfBoundsException with nicer message |
641 |
|
*/ |
642 |
|
private IndexOutOfBoundsException indexError(int index) { |
643 |
< |
return new IndexOutOfBoundsException("Index: " + index + |
643 |
> |
return new IndexOutOfBoundsException("Index: " + index + |
644 |
|
", Size: " + length); |
645 |
|
} |
646 |
|
|
715 |
|
} |
716 |
|
|
717 |
|
public List<E> subList(int fromIndex, int toIndex) { |
718 |
< |
return new SubList(base, this, fromIndex + baseOffset, |
718 |
> |
return new SubList(base, this, fromIndex + baseOffset, |
719 |
|
fromIndex, toIndex); |
720 |
|
} |
721 |
|
|
750 |
|
int cursor; // Current index |
751 |
|
int fence; // Upper bound on cursor |
752 |
|
int lastRet; // Index of returned element, or -1 |
753 |
< |
int expectedModCount; // Expected modCount of base |
753 |
> |
int expectedModCount; // Expected modCount of base |
754 |
|
|
755 |
|
SubListIterator(SubList<E> list, int index) { |
756 |
|
this.lastRet = -1; |
861 |
|
|
862 |
|
class RandomAccessSubList<E> extends SubList<E> implements RandomAccess { |
863 |
|
RandomAccessSubList(AbstractList<E> base, |
864 |
< |
AbstractList<E> parent, int baseIndex, |
864 |
> |
AbstractList<E> parent, int baseIndex, |
865 |
|
int fromIndex, int toIndex) { |
866 |
|
super(base, parent, baseIndex, fromIndex, toIndex); |
867 |
|
} |