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 is checkpoint? How to create checkpoints in our java projects?

1 Answers   ABC,


What is ioc concept?

0 Answers  


how can u cal servlet from java?

7 Answers  


function of extends and implements keywords?

2 Answers  


What is chat area? Explain.

0 Answers  






Difference between swing and awt?

0 Answers  


iam writing the contents to a excel through I/O i am putting first statement as WRITE and then READ(from excel) immediately..later user complains that he is not getting the date by using READ ..wat could be the situation

3 Answers   iGate,


How to implement dphibernate to activate lazy loading in Flex with java ?thanx in advance!

0 Answers  


What are preemptive scheduling and time slicing and what is the difference between them?

1 Answers  


whats is mean by filter?

1 Answers   SolutionNET,


What invokes a thread?s run() method?

2 Answers  


How do you download stubs from a Remote place?

1 Answers  


Categories