Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Store an object in a hash value?

 
Ali Abedi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to store a series of objects in a key/value format. I tried using a HashMap but all I get back are NULLS so I'm assuming the object isn't being stored. Is there a way I can store objects in a key/value format?
Thanks!
 
Philippe Lhoste
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same answer than in Store Object in key/value format thread in Sun forums: show what you try to do. At least a significant running small sample.
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using your own object as a key then you should override equals and hashcoe method.

 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!