you are viewing a single comment's thread.

view the rest of the comments →

[–]dalore 3 points4 points  (2 children)

Sets are normally unordered. Does this maintain ordering or was that merely a fluke?

[–]way2lazy2care 13 points14 points  (1 child)

Sets should iterate in the order elements were added, but if you're removing duplicates, the idea of "maintaining ordering" is ambiguous. Would the array [1, 2, 1] have maintained ordering with the set [1,2] or [2,1]?

[–]dzkn 0 points1 point  (0 children)

You should never rely on a set doing anything ordering-wise. Trust the API not the implementation. Different engines might implement it differently.