When comparing Immutable.Set() and Immutable.OrderedSet() you’ll need to convert the OderedSet down to just a plain Set.
Comparing Immutable.Set() and Immutable.OrderedSet()
To compare equality with a Set and OrderedSet use this:
mySet.equals( myOrderedSet.toSet() )
.equals() compares the left and right to decide if they are both Ordered. If one is ordered and the other is not, they are not equal.
isOrdered(a) !== isOrdered(b).
I find this a bit odd, especially when the left is a plain Set. I feel regardless if the right is Ordered or not, it’s the contents that we’re interested in comparing. However this is the Immutable.js definition. You will need to downgraded the OrderedSet for comparison via
.toSet() which does have a slight cost to it. Immutable performance is worth keeping an eye on.