A
alisyedm
Hi,
I am loading a hashmap with some values (Strings of the format xxx:xxx
) - and the keys are also strings and they are also of the same format
(xxx:xxx) where x can be any alphanumeric character.
Now when I print out the values, I find multiple rows with duplicated
key values....what could that be ? Please help!
Here is something to show what I am doing to get the values:
Iterator it = myHMap.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
String value= (String) myHMap.get(key);
System.out.println("Key: " key + " - Value: " + value);
}
Isn't that as long as I am giving the same key to load the hashmap, it
should overwrite previous values stored with the same key? ( if any)
I am loading a hashmap with some values (Strings of the format xxx:xxx
) - and the keys are also strings and they are also of the same format
(xxx:xxx) where x can be any alphanumeric character.
Now when I print out the values, I find multiple rows with duplicated
key values....what could that be ? Please help!
Here is something to show what I am doing to get the values:
Iterator it = myHMap.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
String value= (String) myHMap.get(key);
System.out.println("Key: " key + " - Value: " + value);
}
Isn't that as long as I am giving the same key to load the hashmap, it
should overwrite previous values stored with the same key? ( if any)