---
title: "What is the difference between HashSet and HashMap?"  
description: "What is the difference between HashSet and HashMap?"  
author: "Anonymous User"  
published: 2015-05-12  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/2517/what-is-the-difference-between-hashset-and-hashmap  
category: "java"  
tags: ["java", "collection"]  
reading_time: 1 minute  

---

# What is the difference between HashSet and HashMap?

HashSet contains only values whereas HashMap contains entry(key,value). HashSet can be iterated but HashMap need to convert into Set to be iterated.

## Answers

### Answer by Anonymous User

HashSet contains only values whereas HashMap contains entry(key,value). HashSet can be iterated but HashMap need to convert into Set to be iterated.


---

Original Source: https://www.mindstick.com/interview/2517/what-is-the-difference-between-hashset-and-hashmap

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
