[kaffe] Re: LinkedList.subList severely broken
Daniel Bonniot
Daniel.Bonniot@inria.fr
Wed May 21 15:09:01 2003
This is a multi-part message in MIME format.
--------------000104010005080105090305
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Sorry, this just doesn't work, since findIndex is too strict in the way
it checks indices: it rejects the case index = size, which is valid for
subList.
So I'm back to the original implementation + changelog (attached).
Daniel
--------------000104010005080105090305
Content-Type: text/plain;
name="LinkedListIterator.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="LinkedListIterator.diff"
Index: ChangeLog
===================================================================
RCS file: /cvs/kaffe/kaffe/ChangeLog,v
retrieving revision 1.1339
diff -u -r1.1339 ChangeLog
--- ChangeLog 19 May 2003 08:01:20 -0000 1.1339
+++ ChangeLog 21 May 2003 22:03:06 -0000
@@ -1,3 +1,9 @@
+2003-05-21 Daniel Bonniot <bonniot@users.sourceforge.net>
+
+ * libraries/javalib/java/util/LinkedListIterator:
+ (LinkedListIterator) make the iteration really take into account
+ the starting index.
+
2003-05-19 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
Add support for Linux/AMD64.
Index: libraries/javalib/java/util/LinkedListIterator.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/util/LinkedListIterator.java,v
retrieving revision 1.1
diff -u -r1.1 LinkedListIterator.java
--- libraries/javalib/java/util/LinkedListIterator.java 14 Jul 1999 00:53:24 -0000 1.1
+++ libraries/javalib/java/util/LinkedListIterator.java 21 May 2003 22:03:34 -0000
@@ -26,6 +26,11 @@
LinkedListIterator(LinkedList list, int index) {
super(list, index);
elem = list.head;
+ // Position elem to the index'th element.
+ // We know that index is a valid index, because that was
+ // checked in the constructor in AbstractListIterator.
+ for (; index > 0; index--)
+ elem = elem.next;
}
public Object next() {
--------------000104010005080105090305--