Map值ASCII排序

public class TestMap {

    public static void main(String[] args) {
        
        Map<String,Object> map = new HashMap<>();
        map.put("B", "2");
        map.put("A", "1");
        map.put("D", "4");
        map.put("C", "3");
        
        SortedMap<String, Object> temps = new TreeMap<>();//升序
        temps.putAll(map);
        System.out.println("ASCII排序:"+temps);
    }
}
 

猜你喜欢

转载自blog.csdn.net/qq501569325/article/details/107845835
今日推荐