Here you can find the source of sortEntrySetToList(Set
public static List<Entry<Long, Long>> sortEntrySetToList(Set<Entry<Long, Long>> set)
//package com.java2s; //License from project: Apache License import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class Main { public static List<Entry<Long, Long>> sortEntrySetToList(Set<Entry<Long, Long>> set) { List<Entry<Long, Long>> list = new LinkedList<Map.Entry<Long, Long>>(set); Collections.sort(list, new Comparator<Entry<Long, Long>>() { @Override// ww w.j av a2 s .c o m public int compare(Entry<Long, Long> o1, Entry<Long, Long> o2) { if (o1.getValue() > o2.getValue()) return 1; if (o1.getValue() < o2.getValue()) return -1; return 0; } }); return list; } }