• Post Reply Bookmark Topic Watch Topic
  • New Topic

HashMap key problem  RSS feed

 
Ådne Brunborg
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wrote the following class to use as a key in a HashMap, but I get multiple entries with what I think are equal keys.

 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your problem is here:


should be:



Although you still risk failure from a NullPointerException. You could change it to something like this:
 
Ådne Brunborg
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<duh>

thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!