65. Compare Hashtable and HashMap?

Compare Hashtable and HashMap?

  • HashTable support synchronization mechanism , and it’s safe for multiple thread unlike the HashMap
  • HashTable don’t support stored any null key and null value while the HashMap supports store one null key and multiple null value
  • About performance, ConcurrentHashMap will better than HashTable beacause ConcurrentHashMap using multiple lock for each bucket while Hashtable only use one lock for all buckets inside it

Leave a Reply

Your email address will not be published. Required fields are marked *