Here you can find the source of sort(Set
public static <T> List<T> sort(Set<T> list, Comparator<T> comparator)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T> List<T> sort(Set<T> list, Comparator<T> comparator) { List<T> result = new ArrayList<T>(list); return sort(result, comparator); }/* w w w . ja v a2 s.com*/ public static <T extends Comparable> List<T> sort(List<T> list) { Collections.sort(list); return list; } public static <T> List<T> sort(List<T> list, Comparator<T> comparator) { Collections.sort(list, comparator); return list; } }