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 the difference between a stub and a skeleton?

9 Answers   ABC, College School Exams Tests, Geoservices, Polaris, Qualcomm, Rajiv Gandhi College of Engineering and Technology RGCET, UTIITSL, Wipro,


whats is statement and procedure

0 Answers   TCS,


What is the difference between system.out ,system.err and system.in?

0 Answers  


How would you reatach detached objects to a session when the same object has already been loaded into the session?

0 Answers  


What is Stream Tokenizer?

0 Answers   TCS,


What classes of exceptions may be caught by a catch clause?

0 Answers  


what are RemoteObjects?

0 Answers   Wipro,


What are the different types of exception?

0 Answers  


In a multitiered application which tier is the browser in?

3 Answers   Adobe,


the use of try and ffinally keyword

1 Answers  


how to use debug in my elipse to solve problems that exist in my project

0 Answers   SAP Labs, TCS,


What is ioc concept & explain it?

0 Answers  


Categories