注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
看面经看到别人问hashtable和hashmap的区别 这里是网上查到的
- 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.
但是我表示我看不懂 我们一般用的是table还是map 比如面试说的那种找words frequence 然后用hash 这个时候我们用的是table还是map?
能不能有哪位高手举个例子讲解一下 真的有点迷糊
|