GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #153 from Flyonsnow/master · bajie123/JavaGuide@3748061

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Java相关
    • HashMap.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Java相关/HashMap.md‎

Copy file name to clipboardExpand all lines: Java相关/HashMap.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneabl
9090
transient int modCount;
9191
// 临界值 当实际大小(容量*填充因子)超过临界值时,会进行扩容
9292
int threshold;
93-
// 填充因子
93+
// 加载因子
9494
final float loadFactor;
9595
}
9696
```
9797
- **loadFactor加载因子**
9898

99-
loadFactor加载因子是控制数组存放数据的疏密程度,loadFactor越趋近于1,那么 数组中存放的数据(entry)也就越多,也就越密,也就是会让链表的长度增加,load Factor越小,也就是趋近于0,
99+
loadFactor加载因子是控制数组存放数据的疏密程度,loadFactor越趋近于1,那么 数组中存放的数据(entry)也就越多,也就越密,也就是会让链表的长度增加,loadFactor越小,也就是趋近于0,数组中存放的数据(entry)也就越少,也就越稀疏。
100100

101101
**loadFactor太大导致查找元素效率低,太小导致数组的利用率低,存放的数据会很分散。loadFactor的默认值为0.75f是官方给出的一个比较好的临界值**。
102102

@@ -401,7 +401,7 @@ final Node<K,V>[] resize() {
401401
else if (oldThr > 0) // initial capacity was placed in threshold
402402
newCap = oldThr;
403403
else {
404-
signifies using defaults
404+
// signifies using defaults
405405
newCap = DEFAULT_INITIAL_CAPACITY;
406406
newThr = (int)(DEFAULT_LOAD_FACTOR * DEFAULT_INITIAL_CAPACITY);
407407
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.