Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • Yep, the primary difference is that Hashtable is synchronized, and HashMap is not. They also have different superclass hierarchies. (FWIW, I've on a couple of occasions seen fairly severe failures in large commercial apps due to using HashMap in a concurrent environment.) Commented Nov 10, 2012 at 1:00
  • BTW, it's "HashMap" and "Hashtable". Note the capitalization. Commented Nov 10, 2012 at 1:01
  • 2
    Did you consider reading the Javadoc? Commented Nov 10, 2012 at 1:08
  • @HotLicks - "I've on a couple of occasions seen fairly severe failures in large commercial apps due to using HashMap in a concurrent environment." - but using a Hashtable might be a bad idea too due to contention issues. Concurrent applications require more sophisticated thinking ... if you want them to scale. Commented Nov 10, 2012 at 1:27
  • Hashtable is more or less deprecated; ConcurrentHashMap is designed to work in a concurrent environment, but is much better at it. Commented Nov 10, 2012 at 2:13