auto commit
This commit is contained in:
@ -389,7 +389,7 @@ transient Node<E> first;
|
||||
transient Node<E> last;
|
||||
```
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/c8563120-cb00-4dd6-9213-9d9b337a7f7c.png" width="450px"> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/c8563120-cb00-4dd6-9213-9d9b337a7f7c.png" width="500px"> </div><br>
|
||||
|
||||
### 2. 与 ArrayList 的比较
|
||||
|
||||
@ -411,7 +411,7 @@ transient Entry[] table;
|
||||
|
||||
Entry 存储着键值对。它包含了四个字段,从 next 字段我们可以看出 Entry 是一个链表。即数组中的每个位置被当成一个桶,一个桶存放一个链表。HashMap 使用拉链法来解决冲突,同一个链表中存放哈希值相同的 Entry。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/9420a703-1f9d-42ce-808e-bcb82b56483d.png" width="500px"> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/9420a703-1f9d-42ce-808e-bcb82b56483d.png" width="550px"> </div><br>
|
||||
|
||||
```java
|
||||
static class Entry<K,V> implements Map.Entry<K,V> {
|
||||
@ -487,7 +487,7 @@ map.put("K3", "V3");
|
||||
- 计算键值对所在的桶;
|
||||
- 在链表上顺序查找,时间复杂度显然和链表的长度成正比。
|
||||
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/e0870f80-b79e-4542-ae39-7420d4b0d8fe.png" width="500px"> </div><br>
|
||||
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/e0870f80-b79e-4542-ae39-7420d4b0d8fe.png" width="550px"> </div><br>
|
||||
|
||||
### 3. put 操作
|
||||
|
||||
|
Reference in New Issue
Block a user