Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
uodut
JavaBase
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
JavaBase
/
CollectionNote
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
23 lines (23 loc) · 1.2 KB
master
Breadcrumbs
JavaBase
/
CollectionNote
Copy path
Top
File metadata and controls
Code
Blame
23 lines (23 loc) · 1.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Collection
List:有序,元素可重复
ArrayList:数组,增删慢,查找快,不同步,允许null值,封装了一个动态再分配的对象数组
LinkedList:链表,增删快,查找慢,不同步,允许null值。
vector:同步,线程安全,效率低
Set:元素唯一,没有重复值
HashSet:允许null,不同步,线程不安全
TreeSet:允许null,不同步,线程不安全,元素有序
EnumSet:键值必须为枚举类型,不允许使用 null 元素,元素有序(保持输入顺序)
LinkedHashSet:允许null,不同步,线程不安全,
Deque:一个线性 collection,支持在两端插入和移除元素,(double ended queue:双端队列的缩写)
ArrayDeque:数组双端队列,禁止null元素,不同步。
Queue:队列,不允许null元素
PriorityQueue:
线程安全(同步)的效率比较低,线程不安全(不同步)的效率比较高.
Map
HashMap:key和value允许为null。线程不安全,基于hash表的Map接口实现
Hashtable:key和value均不允许为null。线程安全。哈希表
TreeMap:key和value均允许为null,线程不安全,基于红黑树(一种自平衡的查找树)
EnumMap:枚举映射中所有键都必须来自单个枚举类型,允许null值,线程不安全。
LinkedHashMap:接口的哈希表和链接列表实现,双重链接列表,有序的(插入顺序一致),其他和HashMap一致
WeakHashMap:允许null,不同步,(具体功能不太懂)
IdentityHashMap:引用相等,区别于HashMap的对象相等。(JVM中,每个对象都有一个独一无二的引用)
You can’t perform that action at this time.