+++++Differrence between HashMap and Hashtable++++
HashMap and Hashtable both implement java.util.Map interface
HashMap Hashtable
1) HashMap is non synchronized. It is not thread safe. 1) Hashtable is synchronized.It is thread safe and can be shaed with manu threads.
2) HashMap allows one null key and multiple null values 2) Hashtable doesnt allow any null key or value
3) HashMap is a new class introduced in JDK 1.2 3) Hashtable is legacy class
4) HashMap is fast 4) hASHTABLE is slow
5) We can make HashMap as synchronized by calling
Map m=Collections.synchronizedMap(hashMap) 5) Hashtable is internally syncronized
No comments:
Post a Comment