public void add(Object o) {
checkRealm();
checkForComodification();
int index = iterator.nextIndex();
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
index, true, o));
updateList(list, diff);
iterator.add(o); // keep in sync
lastElement = null;
lastIndex = -1;
expectedModCount = modCount;
}
public void set(Object o) {
checkRealm();
checkForComodification();
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
lastIndex, false, lastElement), Diffs
.createListDiffEntry(lastIndex, true, o));
updateList(list, diff);
iterator.set(o);
lastElement = o;
expectedModCount = modCount;
}
public void remove() {
checkRealm();
checkForComodification();
if (lastIndex == -1)
throw new IllegalStateException();
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
lastIndex, false, lastElement));
updateList(list, diff);
iterator.remove(); // keep in sync