M*a
3 楼
map不能多线程。table能。貌似是。
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.
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
5 楼
HashTable就是个 legacy class, 需要thread safe也应该用 ConcurrentHashMap.
x*1
7 楼
好虫赶紧给讲讲java 8吧。
R*o
8 楼
hashtable已经是legacy了,不怎么用了,这个区别网上搜一下就差不多了,面试也会
考。
考。
相关阅读
Up and DownsOPT APPROVED 之后大概多久能收到EAD卡research lab 的 interview 是怎样的C++ Q55: (C17)一套算法题opt extension I765上everify company identification number是这里有没有人作supply chain的啊?下周二投行面试,求祝福什么是open house interview?8节电池 那道智力题答案是多少?[请教]要不要reschedule面试?glassdoor上的工资数额准吗?求教H1签证的transfer (转载)有人面过Skype公司么?一个查找算法题什么地方可以找到part-time或者volunteer的工作?C++ Q52: (C6)大家遇到过猎头公司帮办H1B的工作么?Logistics Coordinator, Exportsamateur hire manager?