Class Sort
java.lang.Object
de.uplanet.lucy.server.auxiliaries.collections.Sort
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classComparators forjava.lang.Strings. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComparator<?> createComparator(String p_strClass) Create a comparator for sorting, e.g.Get comparators for strings.<T extends Object & Comparable<? super T>>
Tmax(Collection<? extends T> p_collection) Returns the minimum element of the given collection, according to the natural ordering of its elements.<T> Tmax(Collection<? extends T> p_collection, Comparator<? super T> p_comparator) Returns the minimum element of the given collection, according to the order induced by the specified comparator.<T extends Object & Comparable<? super T>>
Tmin(Collection<? extends T> p_collection) Returns the minimum element of the given collection, according to the natural ordering of its elements.<T> Tmin(Collection<? extends T> p_collection, Comparator<? super T> p_comparator) Returns the minimum element of the given collection, according to the order induced by the specified comparator.List<?> <T extends Comparable<T>>
List<T> Sorts the specified list into ascending order, according to the natural ordering of its elements.<T> List<T> sort(List<T> p_list, Comparator<? super T> p_comparator) Sorts the specified list according to the order induced by the specified comparator.<K extends Comparable<K>,V>
Map<K, V> Try to sort the given map according to the natural ordering of its keys.<K extends Comparable<K>,V>
Map<K, V> sort(Map<K, V> p_map, Comparator<? super K> p_comparator) Try to sort the given map according to the natural ordering of its keys.
-
Constructor Details
-
Sort
public Sort()
-
-
Method Details
-
getString
Get comparators for strings.- Returns:
- The comparators.
-
sort
Sorts the specified list into ascending order, according to the natural ordering of its elements.- Parameters:
p_list- List of objects that should be sorted.- Returns:
- The sorted list (same object as
p_list).
-
sort
Sorts the specified list according to the order induced by the specified comparator.- Parameters:
p_list- List of objects that should be sorted.p_comparator- The comparator to be used.- Returns:
- The sorted list (same object as
p_list).
-
reverse
- Parameters:
p_list- List of objects that should be reverted.- Returns:
- The reverted list (same object as
p_list).
-
min
Returns the minimum element of the given collection, according to the natural ordering of its elements.- Parameters:
p_collection- The collection.- Returns:
- The minimum element.
-
min
Returns the minimum element of the given collection, according to the order induced by the specified comparator.- Parameters:
p_collection- The collection.p_comparator- The comparator.- Returns:
- The minimum element.
-
max
Returns the minimum element of the given collection, according to the natural ordering of its elements.- Parameters:
p_collection- The collection.- Returns:
- The minimum element.
-
max
Returns the minimum element of the given collection, according to the order induced by the specified comparator.- Parameters:
p_collection- The collection.p_comparator- The comparator.- Returns:
- The minimum element.
-
sort
Try to sort the given map according to the natural ordering of its keys. If sorting fails, e.g. due to incomparable keys, the given map is returned.- Parameters:
p_map- The map that should be sorted.- Returns:
- The sorted map, or the original map if sorting was
not possible. If the given map is
null, thennullwill be returned.
-
sort
public <K extends Comparable<K>,V> Map<K,V> sort(Map<K, V> p_map, Comparator<? super K> p_comparator) Try to sort the given map according to the natural ordering of its keys. If sorting fails, e.g. due to incomparable keys, the given map is returned.- Parameters:
p_map- The map that should be sorted.p_comparator- The comparator to be used.- Returns:
- The sorted map, or the original map if sorting was
not possible. If the given map is
null, thennullwill be returned.
-
createComparator
Create a comparator for sorting, e.g.DsSetNameComparatorDsUserItemDisplayNameComparatorDsUserItemFirstNameLastNameComparatorDsUserItemFullNameComparatorDsUserLastNameFirstNameComparatorDsUserLoginNameComparatorUserDisplayNameComparatorUserFirstNameLastNameComparatorUserFullNameComparatorUserLastNameFirstNameComparatorUserLoginNameComparator
- Parameters:
p_strClass- The name of the comparator class, e.g. one of- Returns:
- The requested comparator, or
nullif an error occurred.
-