Reports usages of sameElements
and corresponds
with unsorted collections.
The methods sameElements
and corresponds
use iterators of the given collections
to compare elements depending on the order of their position in the collection.
The result is therefore unpredictable if the order of elements is not well defined,
as it is the case for unordered Sets or Maps.
To fix this consider using ==
, subsetOf
, or bring the elements in some order.
Example:
Set(3,2,1) sameElements Set(1, 2, 3) // is false
// but
Set(1, 2, 3, 4, 5) sameElements Set(5, 4, 3, 2, 1) // is true