Object last = null;
public void add(Object o) {
wrappedIterator.add(o);
lastIndex = previousIndex();
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
lastIndex, true, o));
updateTargetList(diff);
fireListChange(diff);
}
public boolean hasNext() {
return wrappedIterator.hasNext();
}
public boolean hasPrevious() {
return wrappedIterator.hasPrevious();
}
public Object next() {
last = wrappedIterator.next();
lastIndex = previousIndex();
return last;
}
public int nextIndex() {
return wrappedIterator.nextIndex();
}
public Object previous() {
last = wrappedIterator.previous();
lastIndex = nextIndex();
return last;
}
public int previousIndex() {
return wrappedIterator.previousIndex();
}
public void remove() {
wrappedIterator.remove();
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
lastIndex, false, last));
lastIndex = -1;
updateTargetList(diff);
fireListChange(diff);
}
public void set(Object o) {
wrappedIterator.set(o);
ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
lastIndex, false, last), Diffs.createListDiffEntry(
lastIndex, true, o));
last = o;
updateTargetList(diff);
fireListChange(diff);