HashMap、HashTable、ConcurrentHashMap
来源:互联网 发布:用vb编写九九乘法表 编辑:程序博客网 时间:2024/06/11 02:02
区别:
1、HashMap是非synchronized的,HashTable是synchronized的。
2、HashMap可以接受null值(key=null,value=null),HashTable不可以。
3、HashMap的Iterator迭代器是fail-fast的,而Hashtable的enumerator迭代器不是fail-fast的。
所以当有其它线程改变了HashMap的结构(增加或者移除元素),将会抛出ConcurrentModificationException,但迭代器本身的remove()方法移除元素则不会抛出ConcurrentModificationException异常。但这并不是一个一定发生的行为,要看JVM。这条同样也是Enumeration和Iterator的区别。
4、ConcurrentHashMap是HashTable的替代者,具有更好的扩展性。
阅读全文
0 0
- HashMap,HashTable,ConcurrentHashMap,ConcurrentSkipListMap
- HashMap、ConcurrentHashMap、HashTable、HashSet
- ConcurrentHashMap、HashMap、HashTable区别
- HashMap、HashTable、ConcurrentHashMap、Queue
- HashMap HashTable ConcurrentHashmap
- hashMap ,hashTable ,concurrentHashMap区别
- HashMap、HashTable、ConcurrentHashMap
- HashMap HashTable ConcurrentHashMap区别
- HashMap HashTable和ConcurrentHashMap
- Hashtable,HashMap,ConcurrentHashMap
- HashMap HashTable ConCurrentHashMap
- hashmap 、hashtable、 ConcurrentHashMap总结
- HashTable/HashMap/ConcurrentHashMap
- HashMap、HashTable、ConcurrentHashMap
- HashMap、Hashtable与ConcurrentHashMap
- HashMap+ConcurrentHashMap+HashTable
- HashMap HashTable ConcurrentHashMap 区别
- hashmap、hashtable、ConCurrentHashMap分析
- 具体时间的表示
- 初级X编程----信息量挺大的
- php-fpm进程数优化方法
- zcmu-1988
- 1228 序列求和 幂和+伯努利数
- HashMap、HashTable、ConcurrentHashMap
- nginx基础学习
- css font-family的字体英文对照
- 【bzoj1015】[JSOI2008]星球大战 并查集
- 实验五 树和二叉树的实验1 树的顺序结构的实现
- OpenCV的互通性操作(各版本转换)
- 部署ftp
- [设计]备忘录模式
- 聊聊HDFS和Ozone的融合