Java: Is there a way to retrieve, in a Set, an original object from its clone
<p>I need to retrieve, in a Set, an original object from its clone. </p>

<p>I would like to do something like:</p>

<pre><code>Set&lt;Object&gt; mySet;
public void myModifyMethod(Object clone){
    if(mySet.contains(clone)){
        Object original = mySet.get(clone); // get method does not seem to exist

        // Modify original object
    }
}
</code></pre>

<p>I could not find any method in the <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html" rel="nofollow">Java SE 6 API</a> to do that. The only way I can think about is to iterate over the whole set but this is not efficient at all (I was hoping to achieve O(1) from the HashSet, not the O(n) from a sequential search).</p>

<p>Is there a more efficient way to do that?</p>
