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 RRL?

1 Answers  


What is the difference between the string and stringbuffer classes?

0 Answers  


what is the port number of RMI?

2 Answers  


What is the difference between RMI and Socket?

2 Answers  


How are the elements of a borderlayout organized?

0 Answers  






If I define a method in JSP scriplet <%..%>, where will it go after translation into a servlet?

8 Answers   HeadStrong,


difference between apllet and interface class

1 Answers   Infotech,


Explain what is orm?

0 Answers  


What is Lock Based Protocol and what is its use?

2 Answers   Wipro,


How do you iterate in Hashmap?

1 Answers   HCL, Infotech,


What is the relationship between the canvas class and the graphics class?

0 Answers  


explain session tracking. why we used it

3 Answers   Lionbridge,


Categories