• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hash Map question ...

 
Brian Lugo
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question relating to the uniqueness of keys in HashMap. I wrote this program and apparently the HashMap seems to be accepting duplicate keys. Could some one please point out what I am doing wrong or if I am missing something?

Thanks,
Brian
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your equals method should contain "(o instanceof MyType)", not "(o instanceof MyMapKeyType)" ?
-------------
Mapraputa Is, aka hashMap
 
Brian Lugo
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mapraputa !
Yep that was it. How foolish of me ...
Why does'nt the compiler correct my foolish mistakes ? No - Just kidding ...
Brian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic