Update linkedhashmap-source-code.md

This commit is contained in:
cxhello 2023-08-31 16:58:33 +08:00 committed by GitHub
parent 9fbfcee3b5
commit c7c4b3112f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -314,7 +314,7 @@ void afterNodeAccess(Node < K, V > e) { // move node to last
### remove 方法后置操作——afterNodeRemoval
`LinkedHashMap` 并没有对 `remove` 方法进行重写,而直接继承 `HashMap``remove` 方法,为了保证键值对移除后双向链表中的节点也会同步被移除,`LinkedHashMap` 重写了 `HashMap` 的空实现方法 `afterNodeRemoval`
`LinkedHashMap` 并没有对 `remove` 方法进行重写,而直接继承 `HashMap``remove` 方法,为了保证键值对移除后双向链表中的节点也会同步被移除,`LinkedHashMap` 重写了 `HashMap` 的空实现方法 `afterNodeRemoval`
```java
final Node<K,V> removeNode(int hash, Object key, Object value,
@ -585,4 +585,4 @@ linkedHashMap get time: 67
- LinkedHashMap 源码详细分析JDK1.8:<https://www.imooc.com/article/22931>
- HashMap 与 LinkedHashMap:<https://www.cnblogs.com/Spground/p/8536148.html>
- 源于 LinkedHashMap 源码: <https://leetcode.cn/problems/lru-cache/solution/yuan-yu-linkedhashmapyuan-ma-by-jeromememory/>
<!-- @include: @article-footer.snippet.md -->
<!-- @include: @article-footer.snippet.md -->