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

voidsortVersions(List versions)
sort Versions
if (versions != null) {
    Collections.sort(versions);
ListstringListSort(List list)
string List Sort
class ComparatorThis implements Comparator<String> {
    public int compare(String o1, String o2) {
        String s1 = (String) o1;
        String s2 = (String) o2;
        if (s1 == null || s2 == null) {
            return 0;
        return s1.compareTo(s2);
...
ListsubtractSortedLists(List a, List b, Comparator comparator)
subtract Sorted Lists
List<T> result = new ArrayList<T>(a.size());
Iterator<T> aIter = a.iterator();
Iterator<T> bIter = b.iterator();
T aVal = null;
if (aIter.hasNext()) {
    aVal = aIter.next();
T bVal = null;
...
ListtoSortedList(Collection in)
to Sorted List
List<String> out = new ArrayList<>(in);
Collections.sort(out);
return Collections.unmodifiableList(out);
ListtoSortedList(Collection collection)
to Sorted List
List<T> result = new ArrayList<>(collection);
Collections.sort(result);
return result;
ListtoSortedList(Collection collection)
to Sorted List
List<T> list = new LinkedList<>(collection);
Collections.sort(list);
return list;
ListtoSortedList(Collection collection)
to Sorted List
List<T> list = new ArrayList<T>();
list.addAll(collection);
Collections.sort(list);
return list;