--- jsr166/src/main/java/util/ArrayList.java 2005/11/28 02:35:46 1.10 +++ jsr166/src/main/java/util/ArrayList.java 2005/11/28 04:06:29 1.12 @@ -602,7 +602,7 @@ public class ArrayList extends Abstra for (int i=0; i extends Abstra throw new ConcurrentModificationException(); } } + public E previous() { try { int i = cursor - 1; - E next = get(i); + E prev = get(i); lastRet = i; cursor = i; - return next; + return prev; } catch (IndexOutOfBoundsException ex) { throw new NoSuchElementException(); } finally { - if (modCount != expectedModCount) + if (expectedModCount != modCount) throw new ConcurrentModificationException(); } } @@ -732,7 +733,7 @@ public class ArrayList extends Abstra public void remove() { if (lastRet < 0) throw new IllegalStateException(); - if (modCount != expectedModCount) + if (expectedModCount != modCount) throw new ConcurrentModificationException(); ArrayList.this.remove(lastRet); if (lastRet < cursor) @@ -744,19 +745,18 @@ public class ArrayList extends Abstra public void set(E e) { if (lastRet < 0) throw new IllegalStateException(); - if (modCount != expectedModCount) + if (expectedModCount != modCount) throw new ConcurrentModificationException(); ArrayList.this.set(lastRet, e); expectedModCount = modCount; } public void add(E e) { - if (modCount != expectedModCount) + if (expectedModCount != modCount) throw new ConcurrentModificationException(); ArrayList.this.add(cursor++, e); lastRet = -1; expectedModCount = modCount; } } - }