Why does not HashSet.add(Object) replace existing object?
<p>This is more of a design question in which I am curious as to why the HashSet does not support put like operation with the add.</p>

<p>If I want to update an object with equal hashCode as an existing object I have to do this:</p>

<pre><code>hashSet.remove(o);
hasSet.add(o);
</code></pre>

<p>I think a </p>

<pre><code>hashSet.add(o);
</code></pre>

<p>should have sufficed since it uses a HashMap under the hood anyway.</p>