This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Expain me what is hashCode() method

 
sandip sangale
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


1) why to override hashCode() method
we what difference it makes when override.
 
Muhammad Khojaye
Ranch Hand
Posts: 449
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See why we need to override hashcode when write equality method in Java here

 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The article actually says how to override those methods, not why we should.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alessandro Ilardo wrote:The article actually says how to override those methods, not why we should.

Really? Pitfall #2 in the article explains quite clearly what hashCode() is used for, so this makes it clear when and why you should implement a hashCode() method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic