Java tutorial
//package com.java2s; import java.util.*; public class Main { public static List sortMapByKeyDESC(Map map) { List list = new ArrayList(map.entrySet()); Collections.sort(list, new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) ((Map.Entry) (o2)).getKey()).compareTo(((Map.Entry) (o1)).getKey()); } }); return list; } }