Java examples for java.util:List Sort
sort Map Entry Set To List
//package com.java2s; 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);//from w ww . ja v a 2s.co m Collections.sort(list, new Comparator<Entry<Long, Long>>() { @Override 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; } }