Here you can find the source of sort(List> lists)
public static <T extends Comparable<? super T>> void sort(List<List<T>> lists)
//package com.java2s; //License from project: Apache License import java.util.Collections; import java.util.List; import java.util.Map; import java.util.TreeMap; public class Main { public static <T extends Comparable<? super T>> void sort(List<List<T>> lists) { Map<String, List<T>> map = new TreeMap<String, List<T>>(); for (List<T> list : lists) { Collections.sort(list); StringBuilder builder = new StringBuilder(); for (T item : list) { builder.append(item.toString()); }// w w w .j a va 2 s. c om map.put(builder.toString(), list); } lists.clear(); lists.addAll(map.values()); } }