title: Java generics: required capture#67 of?
body: <p>I have this function: </p>
  
  <pre><code> /**
   * Helper function that adds the values of b to the elements of a, treating
   * all keys that exist in b but not in a, as existent in a with value 0. NB:
   * It operates IN PLACE. 
   * @param a The {@link java.util.Map} which will hold the result
   * @param b The {@link java.util.Map} which will be added to a
   */
  private static void sumMaps(Map&lt;?, Integer&gt; a, Map&lt;?,Integer&gt; b)
  {
      for (Object key : b.keySet()) {
          Integer currentCount = a.get(key);
          a.put(key, currentCount == null ? b.get(key) : currentCount + b.get(key));
      }
  }
  </code></pre>
  
  <p>However, NetBeans highlights "key" in the final line of for, and gives me this error: </p>
  
  <pre><code>method put in class java.util.Map&lt;K,V&gt; cannot be applied to given types  
  required: capture #67 of?, java.lang.Integer  
  found: java.lang.Object, int
  </code></pre>
  
  <p>(the int is not the problem because of Java unpacking, I tried using Integers too but it didn't work). </p>