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

How a component can be placed on Windows?

0 Answers   Wipro,


how to search the pertical objects in a Collections

3 Answers   iGate,


What restrictions are placed on the values of each case of a switch statement?

0 Answers  


If we opened Windows Internet Explorer 4 times, does it starts 4 processes or 4 threads?

0 Answers  


Why are component architectures useful?

0 Answers  


Write a java program to find out the sum of harmonic series : 1 + ½ + 1/3 + ……… up to nth term , for any value of n.

2 Answers  


What is Remote Server?

0 Answers   TCS,


java is fully object oriented languages or not? why?

12 Answers   HCL,


Give me simple example of hibernate caching and explain the details of caching????? thanks in adv.

1 Answers  


Differences between applications and applets?

3 Answers  


Explain about RMI Architecture?

0 Answers  


When is the best time to validate input?

0 Answers  


Categories