当前位置:网站首页>The division principle summary within the collection
The division principle summary within the collection
2022-08-09 06:32:00 【The strongest disciple in history】
ArrayList
1. Constructor
new Arraylist(size)
if size ==0 {}
else if size>0 new Object[size];
2. default CAPACITY 10
Expansion:
1. Construct method to expand
2. Add grow method 1.5 times.
HashSet
1. Constructor
Math.max((int) (c.size()/.75f) + 1, 16) 16 or size/0.75 +1 This is for discrete distribution.
2. The bottom layer is the hashmap structure map.put(e, PRESENT);
HashMap
1. The auto-increment factor is 0.75
2. The default capacity is 16 When the number of elements in the HashMap exceeds the capacity * loading factor, the HashMap will expand the capacity
Hash methods to avoid conflicts:
1. Open address method: The open address method is to find the next empty hash address once a conflict occurs, as long as the hash table is large enough, the empty hashThe column address is always found and the record is stored.
2. Re-hash method: If the address conflicts, perform the address and re-hash.
3. Chain address method: The node of the array extends the external node into a linked list structure.
rehash()
0.75*size()
When the number of entries in the hash table exceeds the product of the load factor and the current capacity, and the location to be stored already has elements (hashcollision), two conditions must be met to expand the capacity.
2x the growth
ConcurrentHashMap
put 方法加锁锁的对象是hash 数组的node。
The get method is not locked, volatile.
边栏推荐
- 默默重新开始,第一页也是新的一页
- INSTALL_RPATH and BUILD_RPATH problem in CMake
- 【R语言】对文件进行归一化整理到各文件类型文件夹
- CMake中INSTALL_RPATH与BUILD_RPATH问题
- Likou Brush Question 180
- 语句加锁分析
- Unity C# 委托——事件,Action,Func的作用和区别
- Error: flask: TypeError: 'function' object is not iterable
- CalBioreagents超全Id 蛋白兔单克隆抗体,助力科研
- 单例 DCL(double check lock) 饱汉模式和饿汉模式
猜你喜欢
一道很简答但是没答对的SQL题
中英文说明书丨CalBioreagents 醛固酮单克隆抗体
pycharm环境包导入到另外一个环境
Import the pycharm environment package into another environment
The solution that does not work and does not take effect after VScode installs ESlint
力扣刷题180
Unity Gobang Game Design and Simple AI (2)
Gao Zelong, a famous digital collection expert and founder of the Digital Collection Conference, was interviewed by China Entrepreneur Magazine
Error jinja2.exceptions.UndefinedError: 'form' is undefined
运算放大器(OPA)超详细参数讲解-运放---以及8个型号的运算放大器分析对比
随机推荐
Redis 2 - 高级
【R语言】交互作用 测试数据
Common Oracle Commands
C语言实现顺序栈和链队列
Program Performance Analysis - Complexity Analysis
Deep Learning - Principles of Neural Networks 2
22 high mid term paper topics forecast
MYSQL Advanced Chapter - Query Interception Analysis, Lock Mechanism, Master-Slave Replication
String.toLowerCase(Locale.ROOT)
untiy countdown
CalBioreagents超全Id 蛋白兔单克隆抗体,助力科研
How to find package information and pin definitions for NXP S32K1xx series microcontrollers
zip压缩包密码解密
Data center project preliminary summary
VS2019 common shortcut keys
[R language] Extract all files under a folder to a specific folder
【R语言】把文件夹下的所有文件提取到特定文件夹
语句加锁分析
中英文说明书丨CalBioreagents ACTH N端单克隆抗体
什么是excel文件保护