From 4d47e8a937153616695707cb50b25c97a2d579e1 Mon Sep 17 00:00:00 2001 From: bothner Date: Sun, 26 Sep 2004 20:14:26 +0000 Subject: * java/util/Collections.java (sort): Copy from array in forwards order, rather than reverse order which may be much less efficient. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88146 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/util/Collections.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libjava/java/util') diff --git a/libjava/java/util/Collections.java b/libjava/java/util/Collections.java index d50563c9022..d7b5e54e4a8 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]); } } -- cgit v1.2.3