3 ms·
"is non-deterministic, when you use a plain range to iterate over such a map". If you need ordered iteration to stay deterministic, extract the keys, sort them
by randomswede 5y ago
"is non-deterministic, when you use a plain range to iterate over such a map".
If you need ordered iteration to stay deterministic, extract the keys, sort them, then iterate over the (now-sorted) slice of keys?
If the order matters, you should defensively make SURE you are iterating in that order. If the order doesn't matter, the fact that each iteration over the map is different helps you not fall into a "I know this" trap.