diff --git a/docs/notes/Java 容器.md b/docs/notes/Java 容器.md index eeb5d16a..15cb0431 100644 --- a/docs/notes/Java 容器.md +++ b/docs/notes/Java 容器.md @@ -24,7 +24,7 @@ ## Collection -

+

### 1. Set @@ -50,8 +50,7 @@ ## Map -

- +

- TreeMap:基于红黑树实现。 @@ -66,8 +65,7 @@ ## 迭代器模式 -

- +

Collection 继承了 Iterable 接口,其中的 iterator() 方法能够产生一个 Iterator 对象,通过这个对象就可以迭代遍历 Collection 中的元素。 @@ -128,7 +126,7 @@ public class ArrayList extends AbstractList private static final int DEFAULT_CAPACITY = 10; ``` -

+

### 2. 扩容 @@ -391,7 +389,7 @@ transient Node first; transient Node last; ``` -

+

### 2. 与 ArrayList 的比较 @@ -413,7 +411,7 @@ transient Entry[] table; Entry 存储着键值对。它包含了四个字段,从 next 字段我们可以看出 Entry 是一个链表。即数组中的每个位置被当成一个桶,一个桶存放一个链表。HashMap 使用拉链法来解决冲突,同一个链表中存放哈希值相同的 Entry。 -

+

```java static class Entry implements Map.Entry { @@ -489,7 +487,7 @@ map.put("K3", "V3"); - 计算键值对所在的桶; - 在链表上顺序查找,时间复杂度显然和链表的长度成正比。 -

+

### 3. put 操作 @@ -825,7 +823,7 @@ final Segment[] segments; static final int DEFAULT_CONCURRENCY_LEVEL = 16; ``` -

+

### 2. size 操作 diff --git a/docs/pics/52a7744f-5bce-4ff3-a6f0-8449334d9f3d.png b/docs/pics/52a7744f-5bce-4ff3-a6f0-8449334d9f3d.png new file mode 100644 index 00000000..2474cb63 Binary files /dev/null and b/docs/pics/52a7744f-5bce-4ff3-a6f0-8449334d9f3d.png differ diff --git a/docs/pics/73403d84-d921-49f1-93a9-d8fe050f3497.png b/docs/pics/73403d84-d921-49f1-93a9-d8fe050f3497.png new file mode 100644 index 00000000..94c95a1f Binary files /dev/null and b/docs/pics/73403d84-d921-49f1-93a9-d8fe050f3497.png differ diff --git a/docs/pics/774d756b-902a-41a3-a3fd-81ca3ef688dc.png b/docs/pics/774d756b-902a-41a3-a3fd-81ca3ef688dc.png new file mode 100644 index 00000000..7e79112c Binary files /dev/null and b/docs/pics/774d756b-902a-41a3-a3fd-81ca3ef688dc.png differ diff --git a/docs/pics/93fb1d38-83f9-464a-a733-67b2e6bfddda.png b/docs/pics/93fb1d38-83f9-464a-a733-67b2e6bfddda.png new file mode 100644 index 00000000..58b59ad7 Binary files /dev/null and b/docs/pics/93fb1d38-83f9-464a-a733-67b2e6bfddda.png differ diff --git a/docs/pics/9420a703-1f9d-42ce-808e-bcb82b56483d.png b/docs/pics/9420a703-1f9d-42ce-808e-bcb82b56483d.png new file mode 100644 index 00000000..8cde61d0 Binary files /dev/null and b/docs/pics/9420a703-1f9d-42ce-808e-bcb82b56483d.png differ diff --git a/docs/pics/c8563120-cb00-4dd6-9213-9d9b337a7f7c.png b/docs/pics/c8563120-cb00-4dd6-9213-9d9b337a7f7c.png new file mode 100644 index 00000000..2a46b276 Binary files /dev/null and b/docs/pics/c8563120-cb00-4dd6-9213-9d9b337a7f7c.png differ diff --git a/docs/pics/db808eff-31d7-4229-a4ad-b8ae71870a3a.png b/docs/pics/db808eff-31d7-4229-a4ad-b8ae71870a3a.png new file mode 100644 index 00000000..b8ce57a8 Binary files /dev/null and b/docs/pics/db808eff-31d7-4229-a4ad-b8ae71870a3a.png differ diff --git a/docs/pics/e0870f80-b79e-4542-ae39-7420d4b0d8fe.png b/docs/pics/e0870f80-b79e-4542-ae39-7420d4b0d8fe.png new file mode 100644 index 00000000..b6715dcd Binary files /dev/null and b/docs/pics/e0870f80-b79e-4542-ae39-7420d4b0d8fe.png differ