Collections.java (sort): Copy from array in forwards order...

* java/util/Collections.java (sort):  Copy from array in forwards
	order, rather than reverse order which may be much less efficient.

From-SVN: r88146
This commit is contained in:
Per Bothner 2004-09-26 13:14:26 -07:00 committed by Per Bothner
parent 87c476a22c
commit a22478ced1
2 changed files with 9 additions and 4 deletions

View File

@ -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.

View File

@ -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]);
}
}