Return to Snippet

Revision: 9058
at October 20, 2008 09:13 by multani


Initial Code
HashMap按key排序
 HashMap   map   =   new   HashMap();  
         map.put("0201",   "0201");  
         map.put("01",   "01");  
         map.put("0304",   "0304");  
         map.put("0101",   "0101");  

         Object[]   key   =     map.keySet().toArray();  
         Arrays.sort(key);  

         for   (int   i   =   0;   i   <   key.length;   i++)   {  
                 System.out.println(map.get(key[i]));  
         }

Initial URL
http://levi.bloghome.cn/posts/120920.html

Initial Description

                                

Initial Title
HashMap sort by key

Initial Tags

                                

Initial Language
Java