Why does HashSet<E> not restrict type of argument to E in contains() and remove()
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/857420/what-are-the-reasons-why-map-getobject-key-is-not-fully-generic">What are the reasons why Map.get(Object key) is not (fully) generic</a><br>
  <a href="http://stackoverflow.com/questions/8015720/why-does-javas-treesete-removeobject-not-take-an-e">Why does Java&#39;s TreeSet&lt;E&gt; remove(Object) not take an E</a>  </p>
</blockquote>



<p>Why does HashSet not restrict type of argument to E here:</p>

<pre><code>public boolean contains(Object o)
public boolean remove(Object o)
</code></pre>

<p>like it does for add()</p>

<pre><code>public boolean add(E e)
</code></pre>

<p>I mean if the compiler is enforcing that only objects of type E are being added, then the set can't contain/remove any other type</p>
