Java Utililty Methods List Sort

List of utility methods to do List Sort

Description

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

Method

voidsort(List list)
sort
Collections.sort(list);
Listsort(List list)
sort
if (list != null && list.size() > 0) {
    Collections.sort((List) list);
return list;
Listsort(List list)
sort
if (isNotEmpty(list)) {
    Collections.sort((List) list);
return list;
voidsort(List list)
sort
Collections.sort(list);
voidsort(List list, Comparator c)
sort
list.sort(c);
Listsort(List list, Comparator comparator)
Creates a copy of and sorts the given list.
List<T> copy = new ArrayList<>(list);
Collections.sort(copy, comparator);
return copy;
Listsort(List list, Comparator comparator)
Same as in java.util.Collections, but returns list to allow daisy chaining calls
Collections.sort(list, comparator);
return list;
voidsort(List list, Comparator comparator, String sort, boolean sortOrder)
sort
if (sort != null && !sort.equals("")) {
    list.sort(comparator);
    if (!sortOrder) {
        Collections.reverse(list);
Listsort(List objs, Comparator cp)
sort
List<T> new_objs = new ArrayList<T>();
new_objs.addAll(objs);
Collections.sort(new_objs, cp);
return new_objs;
Listsort(Set list, Comparator comparator)
sort
List<T> result = new ArrayList<T>(list);
return sort(result, comparator);