Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
Watch
Unwatch
Watching
Releases Only
Ignoring
3
Star
48
Fork
24
DreamCoders
/
CoderGuide
Code
Issues
1169
Pull Requests
0
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
List,Set,Map三者的区别?List、Set、Map 是否继 承自 Collection 接口?List、Map、Set 三个接口存取 元素时,各有什么 特点?
Backlog
#IAJKQJ
陌生人
owner
Opened this issue
2024-08-13 10:04
<p><span style="color: rgb(51, 51, 51);">Java </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">容器分为</span><span style="color: rgb(51, 51, 51);"> Collection </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">和</span><span style="color: rgb(51, 51, 51);"> Map </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">两大类,</span><span style="color: rgb(51, 51, 51);">Collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">集合的子接口有</span><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);"> List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">Queue</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">三种子接口。 </span></p><p><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">我们比较常用的是</span><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">,</span><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">接口不是</span><span style="color: rgb(51, 51, 51);"> collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">的子接口。 </span></p><p><span style="color: rgb(51, 51, 51);">Collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">集合主要有</span><span style="color: rgb(51, 51, 51);">List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">和</span><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">两大接口 </span></p><p><span style="color: rgb(51, 51, 51);">List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">:一个有序(元素存入集合的顺序和取出的顺序一致)容器,元素可以重 复,可以插入多个 </span></p><p><span style="color: rgb(51, 51, 51);">null</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">元素,元素都有索引。常用的实现类有</span><span style="color: rgb(51, 51, 51);"> ArrayList</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">LinkedList </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">和</span><span style="color: rgb(51, 51, 51);"> Vector</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">。 </span></p><p><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">:一个无序(存入和取出顺序有可能不一致)容器,不可以存储重复元素, 只允许存入一个 </span></p><p><span style="color: rgb(51, 51, 51);">null</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">元素,必须保证元素唯一性。</span><span style="color: rgb(51, 51, 51);">Set </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">接口常用实现类是</span><span style="color: rgb(51, 51, 51);"> HashSet</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);"> LinkedHashSet </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">以及 </span></p><p><span style="color: rgb(51, 51, 51);">TreeSet</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">。</span></p><p><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">是一个键值对集合,存储键、值和之间的映射。</span><span style="color: rgb(51, 51, 51);"> Key</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">无序,唯一;</span><span style="color: rgb(51, 51, 51);">value </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">不 要求有序,允许重复。 </span></p><p><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">没有继承于</span><span style="color: rgb(51, 51, 51);">Collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">接口,从</span><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">集合中检索元 素时,只要给出键对象,就会返回对应的值对 </span></p><p><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">象。 </span></p><p><span style="color: rgb(51, 51, 51);">Map </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">的常用实现类:</span><span style="color: rgb(51, 51, 51);">HashMap</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">TreeMap</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">HashTable</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">LinkedHashMap</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);"> ConcurrentHashMap </span></p>
<p><span style="color: rgb(51, 51, 51);">Java </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">容器分为</span><span style="color: rgb(51, 51, 51);"> Collection </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">和</span><span style="color: rgb(51, 51, 51);"> Map </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">两大类,</span><span style="color: rgb(51, 51, 51);">Collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">集合的子接口有</span><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);"> List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">Queue</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">三种子接口。 </span></p><p><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">我们比较常用的是</span><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">,</span><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">接口不是</span><span style="color: rgb(51, 51, 51);"> collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">的子接口。 </span></p><p><span style="color: rgb(51, 51, 51);">Collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">集合主要有</span><span style="color: rgb(51, 51, 51);">List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">和</span><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">两大接口 </span></p><p><span style="color: rgb(51, 51, 51);">List</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">:一个有序(元素存入集合的顺序和取出的顺序一致)容器,元素可以重 复,可以插入多个 </span></p><p><span style="color: rgb(51, 51, 51);">null</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">元素,元素都有索引。常用的实现类有</span><span style="color: rgb(51, 51, 51);"> ArrayList</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">LinkedList </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">和</span><span style="color: rgb(51, 51, 51);"> Vector</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">。 </span></p><p><span style="color: rgb(51, 51, 51);">Set</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">:一个无序(存入和取出顺序有可能不一致)容器,不可以存储重复元素, 只允许存入一个 </span></p><p><span style="color: rgb(51, 51, 51);">null</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">元素,必须保证元素唯一性。</span><span style="color: rgb(51, 51, 51);">Set </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">接口常用实现类是</span><span style="color: rgb(51, 51, 51);"> HashSet</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);"> LinkedHashSet </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">以及 </span></p><p><span style="color: rgb(51, 51, 51);">TreeSet</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">。</span></p><p><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">是一个键值对集合,存储键、值和之间的映射。</span><span style="color: rgb(51, 51, 51);"> Key</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">无序,唯一;</span><span style="color: rgb(51, 51, 51);">value </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">不 要求有序,允许重复。 </span></p><p><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">没有继承于</span><span style="color: rgb(51, 51, 51);">Collection</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">接口,从</span><span style="color: rgb(51, 51, 51);">Map</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">集合中检索元 素时,只要给出键对象,就会返回对应的值对 </span></p><p><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">象。 </span></p><p><span style="color: rgb(51, 51, 51);">Map </span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">的常用实现类:</span><span style="color: rgb(51, 51, 51);">HashMap</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">TreeMap</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">HashTable</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);">LinkedHashMap</span><span style="color: rgb(51, 51, 51); font-family: 微软雅黑;">、</span><span style="color: rgb(51, 51, 51);"> ConcurrentHashMap </span></p>
Comments (
0
)
Sign in
to comment
Status
Backlog
Backlog
Doing
Done
Closed
Assignees
Not set
Labels
Java
Not set
Label settings
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (
-
)
Tags (
-
)
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
参与者(1)
1
https://gitee.com/DreamCoders/CoderGuide.git
git@gitee.com:DreamCoders/CoderGuide.git
DreamCoders
CoderGuide
CoderGuide
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register