【发布时间】:2012-09-20 17:11:08
【问题描述】:
Java 中 ConcurrentHashMap 和 Hashtable 有什么区别?
哪个对线程应用程序更有效?
【问题讨论】:
-
对于非线程应用程序,使用
HashMap。 -
始终建议使用 concurrenthashmap 而不是 hashtable。请在上面找到文章ibm.com/developerworks/java/library/j-jtp07233/index.html
-
更多信息请参见stackoverflow.com/a/40878/632951。
-
@Keith Randall,java 中没有非线程应用程序。它要么是多线程的,要么是单线程的(只有主线程)。您说的是单线程应用程序。