// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Arrays;
import java.util.HashMap;

public class HashMapSort {
    public static void main(String[] args) {
        HashMap hm = new HashMap();
        hm.put("c","3");
        hm.put("b","2");
        hm.put("a","1");
        System.out.println(hm);
        Object[] sa = hm.keySet().toArray();
        Arrays.sort(sa);
        for(int i = 0; i < sa.length; i++) {
            String key = (String)sa[i];
            String value = (String)hm.get(key);
            System.out.println(key + "->" + value);
        }
        
    }
}
