difference between HashMap, Hashset and hashTable?

Answers were Sorted based on User's Feedback



difference between HashMap, Hashset and hashTable?..

Answer / sujitpingale

HashMap -
1) unsynchronized and unordered
2) Allow one null key , multiple null values


HashTable -
1) synchronized and unordered
2) Doesn't allow null key and value


HashSet -
1) synchronized and ordered
2) Sort elements in ascending order , doesn't allow duplicate elements

Is This Answer Correct ?    0 Yes 0 No

difference between HashMap, Hashset and hashTable?..

Answer / adarsh m thimmappa

HashTable is a hashing based key-value pair data structure
- doesn't allow null as key
- doesn't allow null as value as well
- not thread safe
- oldest map based data structure available since earlier versions of java

HashMap is a hashing based key-value pair data structure
- allow one null as key
- allows multiple null as more than one value
- not thread safe

HashSet is a hashing based set representation
- holds unique set of keys
- internally uses HashMap
- allows one null value
- not thread safe

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Advanced Java Interview Questions

What modifiers may be used with an interface declaration?

0 Answers  


can i call multipule form beans in Action class?

1 Answers   Wipro,


Why RMI required an interface?

1 Answers  


what is activation monitor and what is its job?

1 Answers  


Why use a datasource when you can directly specify a connection details?

0 Answers  






Is infobus easy to use?

0 Answers  


What are the methods used for inter-thread communication? and in what class these methods are defined?

2 Answers  


What is in-memory replication?

0 Answers  


What is a modular application? What does module-relative mean?

0 Answers  


What is a clone?

0 Answers  


is servlet,struts are threadsafe or not.please telme correct answer

1 Answers   Microsoft,


What is abstract schema?

0 Answers  


Categories