Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

hashcode method  RSS feed

 
Devaki Nihar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the primary key is a composite key having one field of integer type and other of string
What will be the hashcode() method in the primary key class?
Does concat will do the job?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Devaki,

The standard hashCode method works very well with string objects and it�s really well implemented. On the other hand if you'll concatenate the fields of your pk, you�ll always get a unique string. Returning the hashCode of this string I believe is a pretty acceptable hashing algorithm.
Regards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!