Java Challenge 9

#HashSet #EqualsAndHashCode

What will be the output?

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.

--

--

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