-
Notifications
You must be signed in to change notification settings - Fork 785
2019-05-06:请简述 LinkedHashMap 的工作原理和使用方式? #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
HashMap的基础上加入了双向链表记录插入顺序,常用作LRU算法 |
hash表实现快速查询,链表实现有序输出,将链表的快速插入删除和hash表的快速访问结合在一起 |
|
hashMap上接一个链表 |
综上,简单了解了一下linkedHashMap 打卡打卡 |
LinkedHashMap是基于Hash表和链表的实现,并且依靠着双向链表保证迭代顺序是插入的顺序。 |
LinedHashMap 是有序的,且默认为插入的顺序,他是基于HashMap 和双向链表实现的,LinkedHashMap是线程不安全的 |
大家记得, 手写 BitmapLruCache, 我写过;(前一天晚上刚看, 第二天就遇到了, 分分钟默写一遍) |
使用的话当然还是LruCache了, 他有一个三参数方法直接实现LruCache, 可以康康力扣的146题 |
No description provided.
The text was updated successfully, but these errors were encountered: