It's surely faster to add all the elements and then sort, which is why

the class is SortableArrayList rather than SortedArrayList (which would
just always insert sorted in add()).


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1698 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2005-08-16 17:39:49 +00:00
parent 9f00804edf
commit 0d73e38193
@@ -63,9 +63,8 @@ public class Collections
Comparator comparator) Comparator comparator)
{ {
SortableArrayList list = new SortableArrayList(); SortableArrayList list = new SortableArrayList();
while (itr.hasNext()) { CollectionUtil.addAll(list, itr);
list.insertSorted(itr.next(), comparator); list.sort(comparator);
}
return getUnmodifiableIterator(list); return getUnmodifiableIterator(list);
} }