3 ms·
Mutating maps during iteration is a big red flag.
by gethly 1y ago
Mutating maps during iteration is a big red flag.
- furyofantares 1y agoYep. Which is part of why I'd much rather talk accurately about it being the iterator that may or may not encounter newly added values. That makes it a lot clearer where the problem is, which is also where the solution is: get the list of keys you want to work on ahead of time and iterate over those while modifying the map.