What's the intended behavior of this program that uses a Set as the Sequence it currently is?

This is because hash values of String on master now include different random salt on each execution of your program (see @lorentey's recent post) . Since the order of elements in the Set is affected by those hash values, you will get different results between runs.

Given you should never be relying on the set having a particular order full stop, it doesn't matter that that order can vary between runs.

The only thing you can rely on with a Set is that multiple passes over a Set will return the values in the same order on each pass (assuming no mutation is happening in-between).

3 Likes