Suppose that we have a Hash Map with some key value pair and we want to modify either key or value of the Hash Map .So how can we do this?
Asked
Active
Viewed 110 times
1 Answers
7
For changing the value just use
map.put(key,newValue);
for changing the key use
ValueType value = map.get(oldKey);
map.remove(oldKey);
map.put(newKey, value);

ctst
- 1,610
- 1
- 13
- 28