Java Utililty Methods Collection Sort

List of utility methods to do Collection Sort

Description

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

Method

Listsorted(Collection collection)
Similar to #sorted(Collection,Comparator) using the Comparable interface of the given elements
final Comparator<E> comparator = null;
return sorted(collection, comparator);
Listsorted(Collection ss)
sorted
final List<String> sorted = new ArrayList<>(ss);
Collections.sort(sorted);
return sorted;
Listsorted(Collection c)
sorted
return sorted(c, false);
Listsorted(Collection c)
sorted
ArrayList<T> list = new ArrayList<T>(c);
Collections.sort(list);
return list;
Listsorted(Collection collection)
Get a sorted list representation of a collection.
List<T> res = new ArrayList<>(collection);
Collections.sort(res);
return Collections.unmodifiableList(res);
ListsortedByName(Collection unsorted, Comparator comparator, T... exclusions)
sorted By Name
if (unsorted == null) {
    return Collections.emptyList();
List<T> retList = removeExclusionsFrom(unsorted, comparator, exclusions);
Collections.sort(retList, comparator);
return retList;
IterablesortedCollection(final Comparator comparator, final Collection input)
sorted Collection
if (input.size() > 1) {
    final List<T> ret = new ArrayList<>(input);
    Collections.sort(ret, comparator);
    return ret;
} else {
    return input;
ListsortedIfPossible(Collection collection)
sorted If Possible
List<T> result = new ArrayList<>(collection);
try {
    Collections.sort((List) result);
} catch (ClassCastException e) {
} catch (NullPointerException npe) {
return result;
ListsortEntities(Collection entities, Comparator comparator)
Sorts elements provided in entities.
List<T> entityList = new ArrayList<T>(entities);
Collections.sort((List) entityList, comparator);
return entityList;
List>>sortMapByValues( final Map> related_region_counts, Comparator>> comparator)
sort Map By Values
final List<Map.Entry<String, Collection<T>>> sorted = new ArrayList<Map.Entry<String, Collection<T>>>(
        related_region_counts.entrySet());
Collections.sort(sorted, comparator);
return sorted;