title: fast way to check if two sets contain at least one same element
body: <p>I have two TreeMaps and I want to check if they contain at least one identical key (the keys are Strings).
  So I use two loops for comparison:</p>
  
  <pre><code>boolean found = false;
  for(String key1 : map1.keySet()){
      for(String key2 : map2.keySet()){
          if(key1.equals(key2)){
              found = true;
              break;
          }
      }
      if(found){
          break;
      }
  }
  if(found){
      someFunction(map1, map2);
  }
  </code></pre>
  
  <p>As I have 500,000 TreeMaps (with about 1000 keys each) and I want to check each map against each other map, it takes a long time. Does anyone know a faster solution?</p>
  
  <p>*Edit: I want to call the "someFunction()"-method every time I find two maps with at leat one same key. I think in >90% of all cases <code>found == false</code></p>