Here you can find the source of sortList(List
public static <T> void sortList(List<T> sources, Comparator<? super T> comparer)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; public class Main { public static <T> void sortList(List<T> sources, Comparator<? super T> comparer) { if (isEmpty(sources) || comparer == null) { return; }// w w w .j a v a 2 s . c o m Collections.sort(sources, comparer); } public static <T extends Comparable<? super T>> void sortList(List<T> sources) { if (isEmpty(sources)) { return; } Collections.sort(sources); } public static boolean isEmpty(Collection<?> entityList) { return entityList == null || entityList.isEmpty(); } }