The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes HashMap Vs Hash table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "HashMap Vs Hash table" Watch "HashMap Vs Hash table" New topic

HashMap Vs Hash table

Ginu Jacob

Joined: Jun 19, 2005
Posts: 16

Can anyone tell me the difference between hash map and hash table?

I know that hash table does not allow any null values whereas Hash map does.
Any other differences?

Ginu Jacob
Nibin Jacob Panicker

Joined: Aug 16, 2005
Posts: 22
The main diffrence btw HashTable and HashMap is that HashTable methods are Threads-Safe(meaning they are synchronised methods) while HashMap is not ThreadSafe..So basically HashTable is used when more than one thread will be accessing it..
Kudret Serin
Ranch Hand

Joined: Aug 02, 2005
Posts: 167

HashMap can store one null key and multiple null values but HashTable can not have any null.
HashTable is synchronized but HashMap is NOT.
Ginu Jacob

Joined: Jun 19, 2005
Posts: 16
If u have any sample code for the same,please post it..

I agree. Here's the link:
subject: HashMap Vs Hash table
It's not a secret anymore!