title: How to intersect a Guava Range and a TreeSet efficiently?
body: <p>I'd like to take the intersection of a set and a range, so that I get a set containing every element that is not in the range. For example, I'd like a way to take <code>set</code> and <code>range</code> from the following code snippet:</p>
  
  <pre><code>import com.google.common.collect.*;
  
  TreeSet&lt;Integer&gt; set = Sets.newTreeSet();
  Collections.addAll(set, 1,2,3,5,11);
  Range&lt;Integer&gt; range = Range.closed(4,10);
  </code></pre>
  
  <p>and return a new TreeSet containing just <code>5</code></p>