title: Why does the Java compiler not like primitive int as type for values in HashMap?
body: <p>The compiler complains about this code:</p>
  
  <pre><code>    HashMap&lt;String,int&gt; userName2ind = new HashMap&lt;String,int&gt;();
      for (int i=0; i&lt;=players.length; i++) {
          userName2ind.put(orderedUserNames[i],i+1);
      }
  </code></pre>
  
  <p>It writes "unexpected type" and point on <code>int</code>. If I replace <code>int</code> by <code>String</code> and <code>i+1</code> by <code>i+"1"</code>, the compilation goes OK. What is wrong with in here?</p>