public static List<List<String>> lfsort(List<List<String>> list) {
        Map<Integer, Integer> freqs = new HashMap<>();
        list.stream().map(List::size).forEach(l -> freqs.put(l, freqs.compute(l, (k, v) -> v == null ? 1 : v + 1)));
        return list
                .stream()
                .sorted((xs1, xs2) -> freqs.get(xs1.size()) - freqs.get(xs2.size()))
                .collect(toList());
    }
(**) Sorting a list of lists according to length of sublists
java8/src/main/java/com/shekhargulati/ninetynine_problems/_01_lists/P28.java