Is there a recommended way to check whether two scala collection Sets have a non-empty intersection? There is of course the obvious
set1.intersect(set2).isEmpty
But that actually constructs the intersection set first, unless I am mistaken. Is there a better/faster way?
The idiomatic way is to use .intersect() or .diff() but both ways build new collection internally.
Fastest ways are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With