Java Utililty Methods Iterable Sort

List of utility methods to do Iterable Sort

Description

The list of methods to do Iterable Sort are organized into topic(s).

Method

booleanisSorted(Iterable 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) {
...
booleanisSorted(Iterable iterable, final Comparator cmp)
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)
...
Listsort(Iterable things, Comparator comparator)
Returns a sorted copy of the provided collection of things.
List<T> copy = toMutableList(things);
Collections.sort(copy, comparator);
return copy;
IterablesortAscending(Iterable elements)
sort Ascending
List<T> elementsList = toList(elements);
Collections.sort(elementsList);
return elementsList;
Listsorted(Iterable items)
Return the items of an Iterable as a sorted list.
List<T> result = toList(items);
Collections.sort(result);
return result;