最近正准备回顾一下Java,所以在此做一些记录。

LinkedHashMap继承了HashMap,大多数的操作调用的是HashMap的实现,在进行操作的时候多维护了一层双向链表

LinkedHashMap的节点也继承了HashMap的节点,多维护了前置节点和后置节点两个属性

1  static class Entry<K,V> extends HashMap.Node<K,V> {
2         Entry<K,V> before, after;
3         Entry(int hash, K key, V value, Node<K,V> next) {
4             super(hash, key, value, next);
5         }
6     }
View Code

相关文章: