1.

What Is The Difference Between Hashmap And Hashtable Particularly With Regard To Thread-safety?

Answer»

The methods of Hashtable are all SYNCHRONIZED. This is not the case for the HashMap IMPLEMENTATION. HENCE Hashtable is thread-safe WHEREAS HashMap is not thread-safe. For single-threaded applications it is therefore more efficient to use the “NEWER” HashMap implementation.

The methods of Hashtable are all synchronized. This is not the case for the HashMap implementation. Hence Hashtable is thread-safe whereas HashMap is not thread-safe. For single-threaded applications it is therefore more efficient to use the “newer” HashMap implementation.



Discussion

No Comment Found