Commit a22478ce by Per Bothner Committed by Per Bothner

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
parent 87c476a2
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.
......
......@@ -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]);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment