A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Programmer Certification (SCJP/OCPJP)
adding objects to HashMap that have duplicate keys
Joined: Oct 24, 2012
Jan 10, 2013 14:00:16
If I have a
, and I call .put() several times with the same key..for example..
map1.put("Monday", "temp1"); map1.put("Monday", "temp2");
Then the first put() call will return true and the second put() call will return false because the "Monday" key already exists?
Jayesh A Lalwani
Joined: Jan 17, 2008
Jan 10, 2013 14:03:55
put doesn't return a boolean.
returns the previous value. So, first call will return null and second call will return the first object
Don't get me started about those stupid
subject: adding objects to HashMap that have duplicate keys
Reflection Usage Question
HashMap values-- I think I know why but how do I fix this null pointer exception?
HashMap access problem
Problem regarding HashMap.
What will if two object has the same hashcode?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015