* java/util/Collections.java (sort): Copy from array in forwards
order, rather than reverse order which may be much less efficient.
From-SVN: r88146
+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.
{
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]);
}
}