What is the difference between hashset and hashmap?



What is the difference between hashset and hashmap?..

Answer / Kuldeep Sharma

HashSet is a collection that implements the Set interface, while HashMap is a map implementation. HashSet stores unique elements (without duplicates), whereas HashMap maps keys to values. HashSet uses a hash table for fast lookup times, and its primary operation is the boolean contains() method. HashMap provides methods for adding, retrieving, and updating key-value pairs.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is the meaning of arraylist?

1 Answers  


Define tree edge?

1 Answers  


Does arraylist have index?

1 Answers  


What happens if we put duplicate key in hashmap?

1 Answers  


Is arraylist faster than array?

1 Answers  


Is treeset synchronized?

1 Answers  


What is a subtree?

1 Answers  


What are data structures in programming?

1 Answers  


List the abstract operations in the set?

1 Answers  


What are the properties of binary heap?

1 Answers  


List the limitations of linear probing?

1 Answers  


What is the difference between binary tree and binary search tree?

1 Answers  


Categories