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
Is set ordered?
How many ways can an argument be passed to a subroutine and explain them?
What is the similarity between dynamic binding and linking?
Can a class have a static inner class?
What are static methods?
What is treemap in java?
Which is bigger double or float?
which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?
How would you convert bytes to string?
What is a class in java?
Why are pointers not secure?
Does A Class Inherit The Constructors Of Its Superclass?
How do I know if java is installed?
What will be the output of round(3.7) and ceil(3.7)?
What are loops in java? What are three types of loops?