title: Why HashMap with generic declaration "<? super ArrayList> does not accept value "new Object()" in the put method?
body: <p>While working on interview questions, I have come across below code:</p>
  
  <pre><code>List&lt;Object&gt; list = new ArrayList();
  Map&lt;Object, ? super ArrayList&gt; m = new HashMap&lt;Object,  ArrayList&gt;();
  m.put(1, new Object());
  m.put(2, list);
  </code></pre>
  
  <p>The above two put method's are throwing compile time error. But, when I add <code>m.put(3, new ArrayList());</code> it is adding to map with no compile time error. </p>
  
  <p>It is very clear for me that I can add <code>new Object()</code> as a value in <code>HashMap</code> because of the map declaration to be of type <code>&lt; ? super ArrayList&gt;</code>; it means I can add any value that is higher than <code>ArrayList</code> (i.e. <em>super</em> of <code>ArrayList</code>) and <code>ArrayList</code> object too, but not anything below <code>ArrayList</code>.</p>
  
  <p>This particular concept is very well written in SCJP 6 by Kathy Sierra and Bert Bates and based on that theory and examples I assumed it should do job as I understood. Can someone help me understand the error?</p>