what is the difference between HashMap and Hashtable
Answer Posted / jyotsna gupta
1. Hashtable is synchronized where as hashmap is not.
2. Hashmap can contains null values as the keys and as well as values.But Hashtable dose not allow null values as keys and values.
3. Another difference is that iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't. If you change the map while iterating, you'll know.
4. Hashmap is faster than Hashtable.
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is the difference between quicksort & mergesort? When should they be used? What is their running time?
What are advantages of using Java?s layout managers than windowing systems?
What is constructor and its types?
What Is Query Throttling in java?
What is string length in java?
What is difference between jdk,jre and jvm?
What is the use of join method?
Can we convert stringbuffer to string?
Why multiple inheritance is not supported by java?
What does arrays sort do in java?
Are true and false keywords?
In the below example, how many string objects are created?
How to display all the prime numbers between 1 and 100
What is final method?
What is a protected void?