7 ms·
What? Is unordered traversal of a hashmap unexpected? I would be surprised if it did anything different.
by seth1010 12y ago
What? Is unordered traversal of a hashmap unexpected? I would be surprised if it did anything different.
- deleted 12y ago[deleted]
- PeterisP 12y agoIn Java, you could write an unittest that inserts 10 fixed items in a hashmap, checks if the first one is "foobar", and it'd always pass, since the order is predictable - it's essentially sorted by the fixed hashfunction of those keys. In Golang, it'd change between each iteration.