MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / sort

Method sort

vm/JavaAPI/src/java/util/Collections.java:1865–1875  ·  view source on GitHub ↗

Sorts the specified list in ascending natural order. The algorithm is stable which means equal elements don't get reordered. @param list the list to be sorted. @throws ClassCastException when an element in the List does not implement Comparable or elements cannot

(List<T> list)

Source from the content-addressed store, hash-verified

1863 * elements cannot be compared to each other.
1864 */
1865 @SuppressWarnings("unchecked")
1866 public static <T extends java.lang.Comparable<? super T>> void sort(List<T> list) {
1867 Object[] array = list.toArray();
1868 Arrays.sort(array);
1869 int i = 0;
1870 ListIterator<T> it = list.listIterator();
1871 while (it.hasNext()) {
1872 it.next();
1873 it.set((T) array[i++]);
1874 }
1875 }
1876
1877 /**
1878 * Sorts the specified list using the specified comparator. The algorithm is

Callers 15

asSortedListMethod · 0.95
ensureSortedMethod · 0.95
storeMethod · 0.95
getTabIteratorMethod · 0.95
paintElevatedPaneMethod · 0.95
getBackgroundTypesMethod · 0.95
getIndexForKeyMethod · 0.95
L10nEditorMethod · 0.95
initLocaleListMethod · 0.95
ListRendererEditorMethod · 0.95

Calls 7

sortMethod · 0.95
toArrayMethod · 0.65
listIteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
setMethod · 0.65
sizeMethod · 0.65