title: Java: Test for duplicate Objects in a Collection
body: <p>Given a <code>List</code> of <code>MyClass</code> objects (and a custom <code>Comparitor myComparitor</code> if needed), what good options are there for checking if the <code>List</code> contains two "equal" objects?</p>
  
  <p><em>Edit: if there are duplicates, return a reference to one or more of the duplicates.</em></p>
  
  <p>Overriding <code>MyClass.equals(MyClass)</code> in this case is not an option.</p>
  
  <p>My initial thought is to create a hash table of sorts, but I suspect that there's a non-hack way to accomplish the same thing:</p>
  
  <p><code>SortedSet mySet = new TreeSet(myComparitor);</code><br/>
  <code>mySet.addAll(myList);</code><br/>
  <code>// Find duplicates in a sorted set in O(N) time</code><br/></p>
  
  <p><em>P.S. Is there a good reference on Markdown?</em></p>