wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes HashMap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "HashMap" Watch "HashMap" New topic


shree vijay
Ranch Hand

Joined: Sep 18, 2000
Posts: 208
If we add duplicate items in a hashmap as in
when i ask to print out the contents using an iterator, i see that only the last stored value is valid.
That is,
I get Shree 9000
What exactly happens out there? Is the first reference removed and the new one added?


Brian, Cavanagh
Ranch Hand

Joined: Oct 30, 2000
Posts: 70
Hi Shree,
this is taken from javadoc for the put() of HashMap
"If the map previously contained a mapping for this key, the old
* value is replaced."
Brian C
shree vijay
Ranch Hand

Joined: Sep 18, 2000
Posts: 208
Thanks Brian, where do you look up for the javadoc?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
This is the API for 1.3
Scroll down the left to find hashmap and click on it.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link: http://aspose.com/file-tools
subject: HashMap
It's not a secret anymore!