zhuangchong commented on a change in pull request #4896:
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/4896#discussion_r584098814
##########
File path:
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java
##########
@@ -48,7 +48,7 @@
* @return check result code
*/
public Map<String, Object> checkPageParams(int pageNo, int pageSize) {
- Map<String, Object> result = new HashMap<>(2);
+ Map<String, Object> result = new HashMap<>(4);
Review comment:
There is a difference. When the storage is 2 and the capacity is
initialized to 2, automatic scaling of the HashMap is triggered
The HashMap load factor is 0.75 by default, the initialization capacity is
2, and the HashMap is automatically expanded when put the second element
I feel that can use the default capacity, or can specify the initial
capacity, but can't specify an initial value that will trigger HashMap
expansion in scenarios where storage is small
---
是有区别的,当存储为2并初始化容量为2会触发hashmap的自动扩容
hashmap负载因子是默认0.75,初始化容量为2,当put第二个元素的时候会触发hashmap自动扩容
我感觉可以使用默认容量,也可以指定初始容量,但是不能指定一个会触发hashmap扩容并在存储很小的场景下的一个初始值
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]