public class Sorting
extends java.lang.Object
| Constructor and Description |
|---|
Sorting() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(java.lang.Object value1,
java.lang.Object value2)
This compares two values.
|
static int |
compare(java.lang.Object value1,
java.lang.Object value2,
boolean nullsLast)
This compares two values.
|
static <T> java.util.Collection<T> |
sort(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
Sorts a collection based on the natural ascending order.
|
static <T> java.util.Collection<T> |
sort(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
Sorts collection ascending
Nulls last.
|
static <T> java.lang.Iterable<T> |
sort(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
Sorts a iterable based on the natural ascending order.
|
static <T> java.lang.Iterable<T> |
sort(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
Sorts iterable ascending
Nulls last.
|
static <V> java.util.Collection<V> |
sort(java.lang.Class<V> componentType,
java.util.Collection<V> collection,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
Sort collection.
|
static <V> java.lang.Iterable<V> |
sort(java.lang.Class<V> componentType,
java.lang.Iterable<V> iterable,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
Sort collection.
|
static void |
sort(java.util.List list)
Sorts a list based on the natural ascending order.
|
static void |
sort(java.util.List list,
Sort... sorts)
Takes a list an an array or sorts
|
static void |
sort(java.util.List list,
java.lang.String sortBy)
Sorts lists ascending
Nulls last.
|
static void |
sort(java.util.List list,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
Sort a list.
|
static <T> void |
sort(T[] array)
Sorts a array based on the natural ascending order.
|
static <T> void |
sort(T[] array,
java.lang.String sortBy)
Sorts array ascending
Nulls last.
|
static <T> void |
sort(T[] array,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
Sort an array.
|
static <T> java.util.Collection<T> |
sortDesc(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
Sorts a collection based on the natural descending order.
|
static <T> java.util.Collection<T> |
sortDesc(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
Sorts collection ascending
Nulls last.
|
static <T> java.lang.Iterable<T> |
sortDesc(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
Sorts a iterable based on the natural descending order.
|
static <T> java.lang.Iterable<T> |
sortDesc(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
Sorts iterable ascending
Nulls last.
|
static void |
sortDesc(java.util.List list)
Sorts a list based on the natural order descending order.
|
static void |
sortDesc(java.util.List list,
java.lang.String sortBy)
Sorts lists Descending
|
static <T> void |
sortDesc(T[] array)
Sorts a array based on the natural order descending order.
|
static <T> void |
sortDesc(T[] array,
java.lang.String sortBy)
Sorts array Descending
Nulls last.
|
static <T> java.util.Collection<T> |
sortDescNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
Sorts a collection based on the natural descending order.
|
static <T> java.util.Collection<T> |
sortDescNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
Sorts collection ascending
Nulls first.
|
static <T> java.lang.Iterable<T> |
sortDescNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
Sorts a iterable based on the natural descending order.
|
static <T> java.lang.Iterable<T> |
sortDescNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
Sorts iterable ascending
Nulls first.
|
static void |
sortDescNullsFirst(java.util.List list)
Sorts a list based on the natural order descending order.
|
static void |
sortDescNullsFirst(java.util.List list,
java.lang.String sortBy)
Sorts lists Descending
|
static <T> void |
sortDescNullsFirst(T[] array)
Sorts a array based on the natural order descending order.
|
static <T> void |
sortDescNullsFirst(T[] array,
java.lang.String sortBy)
Sorts array Descending
Nulls first.
|
static <K,V> java.util.Collection<java.util.Map.Entry<K,V>> |
sortEntries(java.lang.Class<V> componentType,
java.util.Map<K,V> map,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
Sort map entries.
|
static <K,V> java.util.Collection<java.util.Map.Entry<K,V>> |
sortKeys(java.lang.Class<V> componentType,
java.util.Map<K,V> map,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
Sort map keys.
|
static <T> java.util.Collection<T> |
sortNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
Sorts a collection based on the natural ascending order.
|
static <T> java.util.Collection<T> |
sortNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
Sorts collection ascending
Nulls first.
|
static <T> java.lang.Iterable<T> |
sortNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
Sorts an iterable based on the natural ascending order.
|
static <T> java.lang.Iterable<T> |
sortNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
Sorts iterable ascending
Nulls first.
|
static void |
sortNullsFirst(java.util.List list)
Sorts a list based on the natural ascending order and puts null values first.
|
static void |
sortNullsFirst(java.util.List list,
java.lang.String sortBy)
Sorts lists Ascending Null first
Nulls first.
|
static <T> void |
sortNullsFirst(T[] array)
Sorts an array based on the natural ascending order and puts null values first.
|
static <T> void |
sortNullsFirst(T[] array,
java.lang.String sortBy)
Sorts array ascending
Nulls first.
|
static <K,V> java.util.Collection<java.util.Map.Entry<K,V>> |
sortValues(java.lang.Class<V> componentType,
java.util.Map<K,V> map,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
Sort map values.
|
static java.util.Comparator |
thisUniversalComparator(boolean ascending,
boolean nullsFirst)
This creates the universal comparator object used for "this".
|
static java.util.Comparator |
universalComparator(FieldAccess field,
boolean ascending,
boolean nullsFirst)
This creates the universal comparator object which is used by the sort work horse.
|
public static void sort(java.util.List list,
Sort... sorts)
list - list to sortssorts - what you want to sore the list bypublic static void sort(java.util.List list,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
list - the list you want to sortsortBy - what you want to sort the list byascending - do you want ascending ordernullsFirst - do you want nulls firstpublic static <V> java.util.Collection<V> sort(java.lang.Class<V> componentType,
java.util.Collection<V> collection,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
collection - the collection you want to sortsortBy - what you want to sort the list byascending - do you want ascending ordernullsFirst - do you want nulls firstpublic static <K,V> java.util.Collection<java.util.Map.Entry<K,V>> sortEntries(java.lang.Class<V> componentType,
java.util.Map<K,V> map,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
map - the map entries you want to sortsortBy - what you want to sort the list byascending - do you want ascending ordernullsFirst - do you want nulls firstpublic static <K,V> java.util.Collection<java.util.Map.Entry<K,V>> sortValues(java.lang.Class<V> componentType,
java.util.Map<K,V> map,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
map - the map entries you want to sortsortBy - what you want to sort the list byascending - do you want ascending ordernullsFirst - do you want nulls firstpublic static <K,V> java.util.Collection<java.util.Map.Entry<K,V>> sortKeys(java.lang.Class<V> componentType,
java.util.Map<K,V> map,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
map - the map entries you want to sortsortBy - what you want to sort the list byascending - do you want ascending ordernullsFirst - do you want nulls firstpublic static <V> java.lang.Iterable<V> sort(java.lang.Class<V> componentType,
java.lang.Iterable<V> iterable,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
iterable - the iterable you want to sortsortBy - what you want to sort the list byascending - do you want ascending ordernullsFirst - do you want nulls firstpublic static <T> void sort(T[] array,
java.lang.String sortBy,
boolean ascending,
boolean nullsFirst)
array - the list you want to sortsortBy - what you want to sort the list byascending - do you want ascending ordernullsFirst - do you want nulls firstpublic static void sort(java.util.List list)
list - the list you want to sort.public static <T> void sort(T[] array)
array - the list you want to sort.public static <T> java.util.Collection<T> sort(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
collection - the list you want to sort.public static <T> java.lang.Iterable<T> sort(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
iterable - the list you want to sort.public static void sortNullsFirst(java.util.List list)
list - the list you want to sort.public static <T> void sortNullsFirst(T[] array)
array - the list you want to sort.public static <T> java.util.Collection<T> sortNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
collection - the collection you want to sort.public static <T> java.lang.Iterable<T> sortNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
iterable - the list you want to sort.public static void sortDesc(java.util.List list)
list - the list you want to sort.public static <T> void sortDesc(T[] array)
array - the list you want to sort.public static <T> java.lang.Iterable<T> sortDesc(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
iterable - the iterable you want to sort.public static <T> java.util.Collection<T> sortDesc(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
collection - the collection you want to sort.public static void sortDescNullsFirst(java.util.List list)
list - the list you want to sort.public static <T> void sortDescNullsFirst(T[] array)
array - the list you want to sort.public static <T> java.lang.Iterable<T> sortDescNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable)
iterable - the iterable you want to sort.public static <T> java.util.Collection<T> sortDescNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection)
collection - the collection you want to sort.public static void sort(java.util.List list,
java.lang.String sortBy)
list - the list you want to sortsortBy - what you want to sort the list bypublic static <T> void sort(T[] array,
java.lang.String sortBy)
array - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.lang.Iterable<T> sort(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
iterable - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.util.Collection<T> sort(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
collection - the list you want to sortsortBy - what you want to sort the array bypublic static void sortNullsFirst(java.util.List list,
java.lang.String sortBy)
list - the list you want to sortsortBy - what you want to sort the list bypublic static <T> void sortNullsFirst(T[] array,
java.lang.String sortBy)
array - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.lang.Iterable<T> sortNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
iterable - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.util.Collection<T> sortNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
collection - the list you want to sortsortBy - what you want to sort the array bypublic static void sortDesc(java.util.List list,
java.lang.String sortBy)
list - the list you want to sortsortBy - what you want to sort the list bypublic static <T> void sortDesc(T[] array,
java.lang.String sortBy)
array - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.lang.Iterable<T> sortDesc(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
iterable - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.util.Collection<T> sortDesc(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
collection - the list you want to sortsortBy - what you want to sort the array bypublic static void sortDescNullsFirst(java.util.List list,
java.lang.String sortBy)
list - the list you want to sortsortBy - what you want to sort the list bypublic static <T> void sortDescNullsFirst(T[] array,
java.lang.String sortBy)
array - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.lang.Iterable<T> sortDescNullsFirst(java.lang.Class<T> componentType,
java.lang.Iterable<T> iterable,
java.lang.String sortBy)
iterable - the list you want to sortsortBy - what you want to sort the array bypublic static <T> java.util.Collection<T> sortDescNullsFirst(java.lang.Class<T> componentType,
java.util.Collection<T> collection,
java.lang.String sortBy)
collection - the list you want to sortsortBy - what you want to sort the array bypublic static java.util.Comparator universalComparator(FieldAccess field, boolean ascending, boolean nullsFirst)
field - The field we are sorting on.ascending - if this should be ascending or descending.public static java.util.Comparator thisUniversalComparator(boolean ascending,
boolean nullsFirst)
ascending - if this should be ascending or descending.public static int compare(java.lang.Object value1,
java.lang.Object value2)
value1 - value1value2 - value2public static int compare(java.lang.Object value1,
java.lang.Object value2,
boolean nullsLast)
value1 - value1value2 - value2nullsLast - put nulls lastCopyright © 2014. All Rights Reserved.