Monday, December 31, 2018

Difference between Hashmap and Hashtable?
  • HashMap is non-synchronized. Hashtable is synchronized. 
  • HashMap allows multiple threads where as hashtable doesn't
  • HashMap is not thread-safe where as hashtable is.
  • HashMap allows one null key and any number of null values. Hashtable doesn’t allow null keys and null values.
Note: We can make the HashMap as synchronized by calling this code
Map m = Collections.synchronizedMap(hashMap) [or] can be used ConcurrentHashMap for thread safe. HashMap throws ConcurrentModificationException when if other thread try to add/modify the contents of Object

0 comments:

Post a Comment

selenium-repo by venu

Blog helps to a student or IT employee to develop or improve skills in Software Testing.
For Online Classes Email us: gadiparthi122@mail.com

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts