Java List Sort sort(List> lists)

Here you can find the source of sort(List> lists)

Description

sort

License

Apache License

Declaration

public static <T extends Comparable<? super T>> void sort(List<List<T>> lists) 

Method Source Code

//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());
    }
}

Related

  1. sort(List list, Comparator comparator)
  2. sort(List list1, List list2)
  3. sort(List list)
  4. sort(List source)
  5. sort(List> listOfClassDataList)
  6. sort(List lists)
  7. sort(List list)
  8. sort(List list)
  9. sort(List list)