I am trying to find this information in the Scala documentation but it looks like it is not there.
In the case of Java this was dependent of the Set
implementation that was used, AFAIK. In some cases the method to implement was equals
, in the case of a HashSet
the comparison was done with the hash method.
The actual implementation details of scala.collections.mutable.Set
seem to be unspecified, as the implementation may vary (and that's nice, I like my code to be generic), but I wonder how can I ensure specific comparisons are done with such a generic collection.
For example, in the case of SortedSet
there is an implicit Ordering[A]
to ensure the order. Is there anything similar in the case of Set
?