title: How to test if a Set contains at least one value in another set
body: <p><strong>Given</strong> a <code>Set</code> a with a size a</p>
  
  <p><strong>And</strong> a <code>Set</code> b with a size b</p>
  
  <p>What is the most performant solution to test if b contains at least one value in a.</p>
  
  <p>Solution 1 : What is the complexity of intersect ?</p>
  
  <pre><code>def containsAtLeastOne[A](a:Set[A], b: Set[A]) = a.intersect(b).nonEmpty
  </code></pre>
  
  <p>Solution 2 : O(a) in worst case</p>
  
  <pre><code>def containsAtLeastOne[A](a:Set[A], b: Set[A]) = a.exists(b.contains(_))
  </code></pre>
  
  <p>Solution 3 : O(b) in worst case</p>
  
  <pre><code>def containsAtLeastOne[A](a:Set[A], b: Set[A]) = b.exists(a.contains(_))
  </code></pre>