You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/06/19 04:42:49 UTC
svn commit: r415234 -
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
Author: ndbeyer
Date: Sun Jun 18 19:42:49 2006
New Revision: 415234
URL: http://svn.apache.org/viewvc?rev=415234&view=rev
Log:
Fix the sort method that I broke.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java?rev=415234&r1=415233&r2=415234&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Collections.java Sun Jun 18 19:42:49 2006
@@ -1771,14 +1771,14 @@
* or elements cannot be compared to each other
*/
public static <T extends Comparable<? super T>> void sort(List<T> list) {
- T[] array = list.toArray((T[])new Object[list.size()]);
- Arrays.sort(array);
- int i = 0;
- ListIterator<T> it = list.listIterator();
- while (it.hasNext()) {
- it.next();
- it.set(array[i++]);
- }
+ Object[] array = list.toArray();
+ Arrays.sort(array);
+ int i = 0;
+ ListIterator<T> it = list.listIterator();
+ while (it.hasNext()) {
+ it.next();
+ it.set((T)array[i++]);
+ }
}
/**
@@ -1800,7 +1800,7 @@
ListIterator<T> it = list.listIterator();
while (it.hasNext()) {
it.next();
- it.set((T)array[i++]);
+ it.set(array[i++]);
}
}