Here you can find the source of sort(List
public static List<String> sort(List<String> lists)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; public class Main { public static List<String> sort(List<String> lists) { Collections.sort(lists);/*from w ww. j a va2 s . c om*/ return lists; } public static List<String> sort(Set<String> lists) { if (lists == null) { return null; } else { List<String> result = new ArrayList<String>(); for (String temp : lists) { result.add(temp); } return sort(result); } } }