Author: gbrown
Date: Wed Apr 28 22:53:03 2010
New Revision: 939127
URL: http://svn.apache.org/viewvc?rev=939127&view=rev
Log:
Resolve issue PIVOT-484.
Modified:
pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java?rev=939127&r1=939126&r2=939127&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java Wed Apr 28
22:53:03 2010
@@ -38,6 +38,7 @@ public class ArrayList<T> implements Lis
private class ArrayListItemIterator implements ItemIterator<T> {
private int index = 0;
private int modificationCount;
+ private boolean forward = true;
public ArrayListItemIterator() {
modificationCount = ArrayList.this.modificationCount;
@@ -58,6 +59,7 @@ public class ArrayList<T> implements Lis
throw new NoSuchElementException();
}
+ forward = true;
return get(index++);
}
@@ -76,6 +78,7 @@ public class ArrayList<T> implements Lis
throw new NoSuchElementException();
}
+ forward = false;
return get(--index);
}
@@ -101,7 +104,7 @@ public class ArrayList<T> implements Lis
public void update(T item) {
indexBoundsCheck();
- ArrayList.this.update(index, item);
+ ArrayList.this.update(forward ? index - 1 : index, item);
modificationCount++;
}
@@ -109,6 +112,10 @@ public class ArrayList<T> implements Lis
public void remove() {
indexBoundsCheck();
+ if (forward) {
+ index--;
+ }
+
ArrayList.this.remove(index, 1);
modificationCount++;
}
Modified: pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java?rev=939127&r1=939126&r2=939127&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java Wed Apr
28 22:53:03 2010
@@ -218,8 +218,6 @@ public class LinkedList<T> implements Li
if (forward) {
current = current.previous;
index--;
- } else {
- current = current.next;
}
length--;