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