+ 4
What is purpose of override hashCode() in Java?
This method hashCode(), why we need it and what is purpose to override this method and when? Definitely I'm beginner and this stuck in my mind.
2 odpowiedzi
+ 8
Whenever it(hashcode) is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified
+ 5
Hope this code helps you:
https://code.sololearn.com/cK2H7CdVEq45/?ref=app
In the comments you will also find resources about each methods.