File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1+ # 集合这么多,我该怎么掌握?
2+
3+ 想要掌握集合,必须先知道,为什么会有集合,集合的诞生背景是什么呢?
4+
5+ 想想如果用数组:
6+
7+ - 长度固定,满了需要自己copy扩容
8+ - 需要自己记录实际存储元素,毕竟length只拿到了array的容量
9+ - 只能存放同一类型
10+ - 数组不是面向对象
11+
12+ 用起来是不是不那么顺手?集合就是在这种情况下应运而生。
13+
14+ 不同的集合要解决的问题不一样,这么多类,别死记硬背,根据场景+类前后缀来区别。
15+
16+ - 想要映射关系?一律找Map后缀,映射关系的元素需不需要有序?有序是怎么个有序法?按插入顺序还是访问顺序?那我们可以在Map分类下找LinkedHashMap或TreeMap.
17+ - 只存Value又要有序?使用List集合容器!
18+ - 去重?使用Set集合!想要去重又有序?TreeSet!
19+
20+ ![ ] ( https://upload-images.jianshu.io/upload_images/3167794-9fcf83002bde2e0d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 )
21+
22+
Original file line number Diff line number Diff line change 265265
266266 * 网络协议
267267
268- * 集合框架
269-
268+ * [集合]()
269+ * [集合这么多,我该怎么掌握?](6. 基础能力/集合/集合这么多,我该怎么掌握?.md)
270+ * [HashMap](6. 基础能力/集合/HashMap.md)
271+ * LinkedHashMap
272+ * HashTable
273+ * CurrentHashMap
274+ * TreeMap
275+ * SparseArray
276+
270277* [ 数据结构和算法] (6. 基础能力/数据结构与算法.md)
271278
272279* 操作系统
You can’t perform that action at this time.
0 commit comments