auto commit

This commit is contained in:
CyC2018 2019-04-24 11:25:22 +08:00
parent 5fcf66a16c
commit df717954ff
9 changed files with 8 additions and 10 deletions

View File

@ -24,7 +24,7 @@
## Collection
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/862d5e07-ff6e-4c0d-abe4-08488cbf8049_200.png" width="800px"> </div><br>
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/73403d84-d921-49f1-93a9-d8fe050f3497.png" width="800px"> </div><br>
### 1. Set
@ -50,8 +50,7 @@
## Map
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/8c001caa-cf3d-4793-a64e-6e7dbc446c0d_200.png" width="500px"> </div><br>
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/774d756b-902a-41a3-a3fd-81ca3ef688dc.png" width="500px"> </div><br>
- TreeMap基于红黑树实现。
@ -66,8 +65,7 @@
## 迭代器模式
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/d0c1f611-3bc3-446d-8c0b-1b442b0ae8c91_200.png" width="600px"> </div><br>
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/93fb1d38-83f9-464a-a733-67b2e6bfddda.png" width="600px"> </div><br>
Collection 继承了 Iterable 接口,其中的 iterator() 方法能够产生一个 Iterator 对象,通过这个对象就可以迭代遍历 Collection 中的元素。
@ -128,7 +126,7 @@ public class ArrayList<E> extends AbstractList<E>
private static final int DEFAULT_CAPACITY = 10;
```
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/7c5e4fbe-8aab-4dd6-a7a0-aae39bfd110f_200.png" width="400px"> </div><br>
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/52a7744f-5bce-4ff3-a6f0-8449334d9f3d.png" width="400px"> </div><br>
### 2. 扩容
@ -391,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/a79aec4f-aea4-4ee2-87e3-7c7c6049b90c_200.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="450px"> </div><br>
### 2. 与 ArrayList 的比较
@ -413,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/9ccb276e-6840-4150-ae6d-fc57b8eef35b_200.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="500px"> </div><br>
```java
static class Entry<K,V> implements Map.Entry<K,V> {
@ -489,7 +487,7 @@ map.put("K3", "V3");
- 计算键值对所在的桶;
- 在链表上顺序查找,时间复杂度显然和链表的长度成正比。
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/ff98a336-a390-4d1c-adea-0a49e72fad82_200.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="500px"> </div><br>
### 3. put 操作
@ -825,7 +823,7 @@ final Segment<K,V>[] segments;
static final int DEFAULT_CONCURRENCY_LEVEL = 16;
```
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/d546e754-a5b2-4132-be09-b991f163884b_200.png" width="500px"> </div><br>
<div align="center"> <img src="https://gitee.com/CyC2018/CS-Notes/raw/master/docs/pics/db808eff-31d7-4229-a4ad-b8ae71870a3a.png" width="550px"> </div><br>
### 2. size 操作

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB