List of utility methods to do Iterable Sort
boolean | isSorted(Iterable From http://stackoverflow.com/questions/3047051/how-to-determine-if-a-list-is-sorted-in-java Iterator<T> iter = iterable.iterator(); if (!iter.hasNext()) { return true; T t = iter.next(); while (iter.hasNext()) { T t2 = iter.next(); if (t.compareTo(t2) > 0) { ... |
boolean | isSorted(Iterable is Sorted Iterator<T> iter = iterable.iterator(); if (!iter.hasNext()) { return true; T t = iter.next(); while (iter.hasNext()) { T t2 = iter.next(); if (cmp.compare(t, t2) > 0) ... |
List | sort(Iterable extends T> things, Comparator super T> comparator) Returns a sorted copy of the provided collection of things. List<T> copy = toMutableList(things);
Collections.sort(copy, comparator);
return copy;
|
Iterable | sortAscending(Iterable sort Ascending List<T> elementsList = toList(elements);
Collections.sort(elementsList);
return elementsList;
|
List | sorted(Iterable Return the items of an Iterable as a sorted list. List<T> result = toList(items);
Collections.sort(result);
return result;
|