标签:rtm new tree tor compareto str1 code nbsp int
1.map根据key排序
public static Map<String, String> sortMapByKey(Map<String, String> map) { if (map == null || map.isEmpty()) { return null; } Map<String, String> sortMap = new TreeMap<>(new Comparator<String>() { @Override public int compare(String str1, String str2) { return str1.compareTo(str2); } }); sortMap.putAll(map); return sortMap; }
标签:rtm new tree tor compareto str1 code nbsp int
原文地址:https://www.cnblogs.com/cxhfuujust/p/9190872.html