LinkedHashMap

* 特点: 有序 , 唯一

* 底层的数据结构为: 链表和哈希表 , 链表保证有序 , 哈希表保证唯一

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.util.LinkedHashMap;
public class Demo_LinkedHashMap {
 
    /**
     * @param args
     * LinkedHashMap可以保证怎么存就怎么取
     */
    public static void main(String[] args) {
        LinkedHashMap<String, Integer> lhm = new LinkedHashMap<>();
        lhm.put("张三", 23);
        lhm.put("李四", 24);
        lhm.put("赵六", 26);
        lhm.put("王五", 25);
        System.out.println(lhm);
    }
 
}

 

posted on   LoaderMan  阅读(178)  评论(0编辑  收藏  举报

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

喜欢请打赏

扫描二维码打赏

了解更多

点击右上角即可分享
微信分享提示