Redian新闻
>
hashmap和hashtable的区别?
avatar
hashmap和hashtable的区别?# JobHunting - 待字闺中
T*g
1
貌似前者高端写,google搜出来都不全,大牛给讲讲吧~
avatar
w*z
2
Java?最主要一个是thread safe, 一个不是。

【在 T******g 的大作中提到】
: 貌似前者高端写,google搜出来都不全,大牛给讲讲吧~
:

avatar
M*a
3
map不能多线程。table能。貌似是。
avatar
f*n
4
There are several differences between HashMap and Hashtable in Java:
Hashtable is synchronized, whereas HashMap is not. This makes HashMap better
for non-threaded applications, as unsynchronized Objects typically perform
better than synchronized ones.
Hashtable does not allow null keys or values. HashMap allows one null key
and any number of null values.
One of HashMap's subclasses is LinkedHashMap, so in the event that you'd
want predictable iteration order (which is insertion order by default), you
could easily swap out the HashMap for a LinkedHashMap. This wouldn't be as
easy if you were using Hashtable.
avatar
g*g
5
HashTable就是个 legacy class, 需要thread safe也应该用 ConcurrentHashMap.
avatar
s*k
6
hashtable一般不用了

【在 T******g 的大作中提到】
: 貌似前者高端写,google搜出来都不全,大牛给讲讲吧~
:

avatar
x*1
7
好虫赶紧给讲讲java 8吧。
avatar
R*o
8
hashtable已经是legacy了,不怎么用了,这个区别网上搜一下就差不多了,面试也会
考。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。