Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collections; import java.util.Comparator; public class Main { public static <T> void sort(java.util.List<T> list, Comparator<? super T> comparator) { if (list == null || list.size() < 2) { return; // nothing to sort if null / empty / 1 element } Collections.sort(list, comparator); } }