Java Collection Sort sorted(Collection input)

Here you can find the source of sorted(Collection input)

Description

sorted

License

Open Source License

Declaration

public static <T extends Comparable> List<T> sorted(Collection<? extends T> input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static <T extends Comparable> List<T> sorted(Collection<? extends T> input) {
        List<T> sortable = new ArrayList<>(input);
        Collections.sort(sortable);
        return sortable;
    }//from ww w .  j  a va 2  s  .  c o m

    public static <T> List<T> sorted(Collection<? extends T> input, Comparator<T> cmp) {
        List<T> sortable = new ArrayList<>(input);
        Collections.sort(sortable, cmp);
        return sortable;
    }
}

Related

  1. sort(Collection collection, Comparator comparator)
  2. sort(Collection items)
  3. sortByDescendingOrder(Map collection)
  4. sortClassesByLevelOfInheritance(Collection> classes)
  5. sorted(Collection coll)
  6. sorted(Collection coll)
  7. sorted(Collection collection)
  8. sorted(Collection ss)
  9. sorted(Collection c)