• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is a hash code?  RSS feed

 
Bud Tippins
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone explain, in simple terms what is a hash code? Thank you.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A hashcode is the result of a computation, based on input. A simple hash might be to add up the ascii values of the characters in a string. The idea is that you want different inputs to give you different hashcodes - or at least most of them to, since you have to have a finite number of possible results.

You use this to quickly find stuff, or to check if something has already been stored. The wikipedia has a good article on hash_codes.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!