This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

hashcode method

 
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!