update map while iterating java code example
Example: update hashmap value while iterating
for (Map.Entry<Key, Long> entry : playerCooldowns.entrySet()) {
entry.setValue(entry.getValue() - 20);
}
for (Map.Entry<Key, Long> entry : playerCooldowns.entrySet()) {
entry.setValue(entry.getValue() - 20);
}