Here you can find the source of stringListSort(List
public static List<String> stringListSort(List<String> list)
//package com.java2s; import java.util.*; public class Main { public static List<String> stringListSort(List<String> list) { 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; }//from w ww . j a v a 2 s . c om return s1.compareTo(s2); } } ; Comparator<String> comparator = new ComparatorThis(); Collections.sort(list, comparator); return list; } }