1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-20 22:17:09 +08:00

Update 数据结构.md

Set集合子类HashSet与TreeSet去除重复实现。
This commit is contained in:
ChenTao-Ji 2019-09-27 16:20:56 +08:00 committed by GitHub
parent d7c984b45e
commit efbc582a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,7 @@ Queue 用来存放 等待处理元素 的集合,这种场景一般用于缓冲
### 什么是 Set
Set 继承于 Collection 接口,是一个不允许出现重复元素,并且无序的集合,主要 HashSet 和 TreeSet 两大实现类。
在判断重复元素的时候Set 集合会调用 hashCode()和 equal()方法来实现。
在判断重复元素的时候,HashSet 集合会调用 hashCode()和 equal()方法来实现TreeSet 集合会调用compareTo方法来实现。
### 补充:有序集合与无序集合说明
- 有序集合:集合里的元素可以根据 key 或 index 访问 (List、Map)