Here you can find the source of sort(Set data)
public static List sort(Set data)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Set; public class Main { public static List sort(Set data) { List list = new ArrayList(); for (Iterator it = data.iterator(); it.hasNext();) { list.add(it.next());/*from w w w . ja v a 2 s. com*/ } Collections.sort(list, (Object o1, Object o2) -> o1.toString().compareTo(o2.toString())); return list; } }