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