使用SortedMap对HashMap排序
发布日期:2022-01-11 03:09:52 浏览次数:6 分类:技术文章

本文共 780 字,大约阅读时间需要 2 分钟。

//SortedMap  所有参与传参的参数按照accsii排序(升序)           HashMap
map=new HashMap
();            map.put("1","11");            map.put("2", "22");            map.put("3", "33");            for (Entry
entry: map.entrySet()) {             System.out.println("排序之前:"+entry.getKey()+" 值"+entry.getValue());                         }            System.out.println("======================================================");          SortedMap
sort=new TreeMap
(map);            Set es = sort.entrySet();          Iterator it = es.iterator();            while(it.hasNext())            {                Map.Entry entry = (Map.Entry)it.next();                 System.out.println("排序之后:"+entry.getKey()+" 值"+entry.getValue());            }    

转载地址:https://yuki-ho.blog.csdn.net/article/details/52301617 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:微信 支付(H5) (七) --基于Spring
下一篇:MD5帮助类

发表评论

最新留言

很好
[***.229.124.182]2024年04月24日 11时23分15秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章