更新时间:2023-01-08 10:12:22
map.put(entry.getKey() ,MY_VALUE);
}
}
I have a HashMap
with some Keys - Values
.
On some condition I want to update all values to single value regardless of keys.
Is there any util or predefined methods to do this, without for loop?
Any suggestions?
if (yourCondition) {
for (Map.Entry<String, String> entry : map.entrySet()) {
map.put(entry.getKey(), MY_VALUE);
}
}