Example & Tutorial understanding programming in easy ways.

What is difference between HashMap and HashTable?

Following are some difference as :

                                   HashMap                         HashTable
1 Hashmap is not synchronized in nature .
1 Hashtable is synchronised.
2 iterator in the HashMap is fail-safe .
Fail-safe - “if the Hashtable is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove method, the iterator will throw a ConcurrentModificationException”
2 while for the Hashtable is not.
3 HashMap permits null values and only one null key.
3 while Hashtable doesn't allow key or value as null.
4 HashMap use iterator.
4 Hashtable use enumeration.
5 HashMap is faster. 5 Hashtable is slower.

Read More →
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!