• Post Reply Bookmark Topic Watch Topic
  • New Topic

Altering Object's hashcode ...  RSS feed

 
Brian Lugo
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What causes an Object's hashcode to be altered.
I came across this in ExamPrep book with refrence to Hashtable. The author says:
-- Don't alter an object stored in a Hashtable, if the modification affects the hashcode. If you have to alter an object, remove it from the table, modify it, and then put it back. --
Thanks,
Brian
 
Brian Lugo
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind,
I guess this may be in reference to the classes
that implement their own hashcode method by overriding Object/Parent class hashcode method.
Brian
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!