title: Best way to merge and remove duplicates from multiple lists in Java
body: <p>I have a situation where I will be receiving 2+ <code>ArrayList&lt;Widget&gt;</code> and I need to be able to merge all the lists and remove any duplicate <code>Widget</code> so that I wind up with only 1 <code>ArrayList&lt;Widget&gt;</code> that contains all <code>Widget</code>s from all the merged lists, but without any duplicates.</p>
  
  <p>Assume <code>Widget</code> has an overridden <code>equals</code> method that <em>can</em> be used for determining whether two <code>Widget</code>s are duplicates, although there may be a better way:</p>
  
  <pre><code>public ArrayList&lt;Widget&gt; mergeAndRemoveDupes(ArrayList&lt;Widget&gt; widgets...) {
      // ???
  }
  </code></pre>
  
  <p>Looking for the most algorithmically efficient way of accomplishing this. I am happy to use Apache Commons or any other open source libs that would help me out too! Thanks in advance!</p>