//我們了解treemap是可以排序的,我們可以自己更改排序的手段。 Map<String,String> bankGroup = new TreeMap<String,String>( new Comparator() { private RuleBasedCollator collator =null; { collator = (RuleBasedCollator)Collator.getInstance(java.util.Locale.CHINA);//因為key中可能含有中文 } public int compare(Object o1, Object o2) { //如果有空值,直接返回0 if (o1 == null || o2 == null) return 0; CollationKey ck1 = collator.getCollationKey(String.valueOf(o1)); CollationKey ck2 = collator.getCollationKey(String.valueOf(o2)); return ck1.compareTo(ck2); } } );