diff options
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/util/Collections.java | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3bf4f1d..2a68a96 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2004-09-26 Per Bothner <per@bothner.com> + + * java/util/Collections.java (sort): Copy from array in forwards + order, rather than reverse order which may be much less efficient. + 2004-09-26 Mark Wielaard <mark@klomp.org> * java/lang/System.java (properties): Make package private. diff --git a/libjava/java/util/Collections.java b/libjava/java/util/Collections.java index d50563c..d7b5e54 100644 --- a/libjava/java/util/Collections.java +++ b/libjava/java/util/Collections.java @@ -1713,11 +1713,11 @@ public class Collections { Object[] a = l.toArray(); Arrays.sort(a, c); - ListIterator i = l.listIterator(a.length); - for (int pos = a.length; --pos >= 0; ) + ListIterator i = l.listIterator(); + for (int pos = 0, alen = a.length; pos < alen; pos++) { - i.previous(); - i.set(a[pos]); + i.next(); + i.set(a[pos]); } } |