title: How to intersect multiple sets?
body: <p>I have this list:</p>
  
  <pre><code>private List&lt;Set&lt;Address&gt;&gt; scanList;
  </code></pre>
  
  <p>So my list contains multiple scans as you can see.
  After each scan I add new set into the list.</p>
  
  <p>After all scans are finished I would like to take only the addresses that occur in every set and put it into:</p>
  
  <pre><code>private List&lt;Address&gt; addresses;
  </code></pre>
  
  <p>Does something like this already exists in Set/TreeSet/HashSet?</p>
  
  <p>EDIT: after answers, retainAll() is the right method. Thank you.
  Here is the source:</p>
  
  <pre><code>Set&lt;Address&gt; addressCross = scanList.get(0);
  for (int i = 1; i &lt; scanList.size(); i++) {
      addressCross.retainAll(scanList.get(i));
  }   
  for (Address address : addressCross) {
      addresses.add(address);
  }
  </code></pre>