Thursday, July 8, 2021

What is the difference between HashMap and Hashtable ?

In this article, we will discuss the most popular interview question in the Collection framework.



  1. HashMap allows one null key and multiple null values. But in another way Hashtable is not allowed null key or values.
  2. HashMap is non-synchronized means It does not contain any synchronized method. Hashtable is synchronized.
  3. HashMap performance-wise is good as compare to Hashtable.
  4. HashMap is used array and Linked-List for storing the key and values. Hashtable is used a hashtable data structure.
  5. HashMap is useful in a non-multithreaded environment and Hashtable is useful in a multithreaded environment







No comments:

Post a Comment

What is Lambda expression and it's used ?

  In this article, we will discuss the most important features in Java 8 Lambda expression. First, We will discuss Lambda expression and the...