当前位置:编程学习 > JAVA >>

TreeMap排序

ArrayList<Integer> list = new ArrayList<Integer>();
        TreeMap<Integer, Integer> tm = Calculate.tjj(0);
        // 倒序
        NavigableSet<Integer> descendingKeySet = tm.descendingKeySet();
        // 顺序
        // Set testset = tm.keySet();
        Iterator<Integer> it = descendingKeySet.iterator();
        while (it.hasNext()) {
            int key = it.next();
            System.out.println("key:" + key);
            int paramObject = tm.get(key);
            System.out.println(paramObject);
            list.add(paramObject);
        }
 
作者“test”

补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,