---
title: "Discussion on \"Overriding equals() and hashcode()\" | Hashnode"
description: "Discussion on \"Overriding equals() and hashcode()\". 0. Introduction\nWhen discussing HashMap in Java interviews, a very common follow-up question appears after explaining hash collisions:\n\"Why do we need to override both equals() and hashCode()?\"\nHoweve"
url: "https://hashnode.com/posts/java-override-equals-hashcode/69a898bc3b896f7ad67f8398"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Overriding equals() and hashcode()](https://ejjung.hashnode.dev/java-override-equals-hashcode?utm_source=hashnode&utm_medium=feed)

0\. Introduction When discussing HashMap in Java interviews, a very common follow-up question appears after explaining hash collisions: "Why do we need to override both equals() and hashCode()?" Howeve

Mar 4 · 4 min read · ejjung.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#equals](https://hashnode.com/tag/equals)
-   [#override](https://hashnode.com/tag/override)
-   [#hashmap](https://hashnode.com/tag/hashmap)

## Written by

[EJ Jung](https://hashnode.com/@ejjung)

@ejjung · Bellevue, WA

  
[View profile](https://hashnode.com/@ejjung)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
