Java Challenge 9

#HashSet #EqualsAndHashCode

What will be the output?

Aham Brahmasami
A{a=2, name='Govinda'}

That means, If the set has already an entry with the same hash key then it does not replace the old entry, it discards the new entry.

I was surprised to see; why there is no replace() method for the set but we have in other collections. Let me know the reason in the comment box below.

Thanks.

--

--

--

Java Challenge: A Java question will be published every Saturday. Stay tuned!

Recommended from Medium

📸 Swift Camera — Part 1

An introduction

Setting up JAVA_HOME on MacOS

How to Extract AMP4email Markup from Gmail

CS373: Final Entry

Generic Methods and Type Inference

This Week in Coding: Selection Sort

DeFi Frens Art & Generation Pipeline

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Govinda Raj

Govinda Raj

Senior Software Developer. Tech Enthusiast and love coding. My portfolio: https://govinda-raj.github.io/

More from Medium

Classes and Objects in Java

Java OOPs Concepts

OOPs in Java

Singleton Design Pattern (Java)