HashMap class is roughly equivalent to Hashtable, except that
1. HashMap allows null values for key and value whereas Hashtable doesnt allow.
2. HashMap does not guarantee that the order of the map will remain constant over time. 3. HashMap is non synchronized where as Hashtable is synchronized.
4. HashTable is an Old java class but Hashmap is a new java class in java 2.
5. In HashTable you can change the iteration but in the case of HashMap you can change the iteration but you will get a java.util.ConcurrentModificationException.
0 Responses to What is the Difference between HashMap and HashTable
Something to say?