73 |
* <code>add(int, Object)</code> and <code>remove(int)</code> methods. |
* <code>add(int, Object)</code> and <code>remove(int)</code> methods. |
74 |
* Otherwise, this field may be ignored. |
* Otherwise, this field may be ignored. |
75 |
*/ |
*/ |
76 |
protected int modCount = 0; |
protected int modCount; |
77 |
|
|
78 |
/** |
/** |
79 |
* The main constructor, for use by subclasses. |
* The main constructor, for use by subclasses. |
209 |
{ |
{ |
210 |
if (o == this) |
if (o == this) |
211 |
return true; |
return true; |
212 |
if (!(o instanceof List)) |
if (! (o instanceof List)) |
213 |
return false; |
return false; |
214 |
int size = size(); |
int size = size(); |
215 |
if (size != ((List) o).size()) |
if (size != ((List) o).size()) |
323 |
AbstractList.this.remove(last); |
AbstractList.this.remove(last); |
324 |
pos--; |
pos--; |
325 |
size--; |
size--; |
|
knownMod = modCount; |
|
326 |
last = -1; |
last = -1; |
327 |
|
knownMod = modCount; |
328 |
} |
} |
329 |
}; |
}; |
330 |
} |
} |
446 |
throw new IllegalStateException(); |
throw new IllegalStateException(); |
447 |
AbstractList.this.remove(lastReturned); |
AbstractList.this.remove(lastReturned); |
448 |
size--; |
size--; |
|
knownMod = modCount; |
|
449 |
position = lastReturned; |
position = lastReturned; |
450 |
lastReturned = -1; |
lastReturned = -1; |
451 |
|
knownMod = modCount; |
452 |
} |
} |
453 |
|
|
454 |
public void set(Object o) |
public void set(Object o) |
721 |
checkMod(); |
checkMod(); |
722 |
checkBoundsInclusive(index); |
checkBoundsInclusive(index); |
723 |
backingList.add(index + offset, o); |
backingList.add(index + offset, o); |
|
modCount = backingList.modCount; |
|
724 |
size++; |
size++; |
725 |
|
modCount = backingList.modCount; |
726 |
} |
} |
727 |
|
|
728 |
/** |
/** |
736 |
checkMod(); |
checkMod(); |
737 |
checkBoundsExclusive(index); |
checkBoundsExclusive(index); |
738 |
Object o = backingList.remove(index + offset); |
Object o = backingList.remove(index + offset); |
|
modCount = backingList.modCount; |
|
739 |
size--; |
size--; |
740 |
|
modCount = backingList.modCount; |
741 |
return o; |
return o; |
742 |
} |
} |
743 |
|
|
754 |
checkMod(); |
checkMod(); |
755 |
|
|
756 |
backingList.removeRange(offset + fromIndex, offset + toIndex); |
backingList.removeRange(offset + fromIndex, offset + toIndex); |
|
modCount = backingList.modCount; |
|
757 |
size -= toIndex - fromIndex; |
size -= toIndex - fromIndex; |
758 |
|
modCount = backingList.modCount; |
759 |
} |
} |
760 |
|
|
761 |
/** |
/** |
771 |
checkBoundsInclusive(index); |
checkBoundsInclusive(index); |
772 |
int csize = c.size(); |
int csize = c.size(); |
773 |
boolean result = backingList.addAll(offset + index, c); |
boolean result = backingList.addAll(offset + index, c); |
|
modCount = backingList.modCount; |
|
774 |
size += csize; |
size += csize; |
775 |
|
modCount = backingList.modCount; |
776 |
return result; |
return result; |
777 |
} |
} |
778 |
|
|
855 |
public void remove() |
public void remove() |
856 |
{ |
{ |
857 |
i.remove(); |
i.remove(); |
|
modCount = backingList.modCount; |
|
858 |
size--; |
size--; |
859 |
position = nextIndex(); |
position = nextIndex(); |
860 |
|
modCount = backingList.modCount; |
861 |
} |
} |
862 |
|
|
863 |
public void set(Object o) |
public void set(Object o) |
868 |
public void add(Object o) |
public void add(Object o) |
869 |
{ |
{ |
870 |
i.add(o); |
i.add(o); |
|
modCount = backingList.modCount; |
|
871 |
size++; |
size++; |
872 |
position++; |
position++; |
873 |
|
modCount = backingList.modCount; |
874 |
} |
} |
875 |
|
|
876 |
// Here is the reason why the various modCount fields are mostly |
// Here is the reason why the various modCount fields are mostly |