'--' the document say: Creates a new $coll from this $coll by removing all elements of another collection.
'&~' the document say: The difference of this set and another set.
i use both of two symbol can get same result.
so is there have some difference between this two symbol? For example, there are different time complexity or memory occupation?
CodePudding user response:
According to the Scaladoc.
--
accepts any kind of IterableOnce
whereas &~
only accepts other Sets
Arguably, if you have two sets, you should prefer &~
since it is probably optimized.
CodePudding user response:
--
only creates a new collection for immutable sets. It is in place for mutable ones.