T******g 发帖数: 790 | 1 貌似前者高端写,google搜出来都不全,大牛给讲讲吧~
|
w**z 发帖数: 8232 | 2 Java?最主要一个是thread safe, 一个不是。
【在 T******g 的大作中提到】 : 貌似前者高端写,google搜出来都不全,大牛给讲讲吧~ :
|
M**a 发帖数: 848 | |
f*****n 发帖数: 2126 | 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. |
g*****g 发帖数: 34805 | 5 HashTable就是个 legacy class, 需要thread safe也应该用 ConcurrentHashMap. |
s********k 发帖数: 2352 | 6 hashtable一般不用了
【在 T******g 的大作中提到】 : 貌似前者高端写,google搜出来都不全,大牛给讲讲吧~ :
|
x*******1 发帖数: 28835 | |
R*********o 发帖数: 33 | 8 hashtable已经是legacy了,不怎么用了,这个区别网上搜一下就差不多了,面试也会
考。 |