title: How generic is K,V?
body: <p>If I define a <code>Map&lt;K,V&gt; map = new HashMap&lt;K, V&gt;()</code> why can't I do something like:   </p>
  
  <p><code>map.put(new MyKey&lt;CustomObject&gt;(), new SomeOtherObject&lt;CustomObject&gt;());</code>  </p>
  
  <p>But if I do it via another method it works i.e.:  </p>
  
  <pre><code>add(new MyKey&lt;CustomObject&gt;(), new SomeOtherObject&lt;CustomObject&gt;());  
  
  public &lt;K, V&gt; void add(K k, V v){  
          Map&lt;K, V&gt; threadLocalMap = new HashMap&lt;K, V&gt;();  
          threadLocalMap.put(k, v);  
  }  
  </code></pre>