title: Why is Long.valueOf(0).equals(Integer.valueOf(0)) false?
body: <p>This questions is prompted by <a href="https://stackoverflow.com/questions/444638/strange-hashmap-put-behaviour#444757">strange HashMap.put() behaviour</a></p>
  
  <p>I think I understand why <code>Map&lt;K,V&gt;.put</code> takes a <code>K</code> but <code>Map&lt;K,V&gt;.get</code> takes an <code>Object</code>, it seems not doing so will break too much existing code. </p>
  
  <p>Now we get into a very error-prone scenario:</p>
  
  <pre><code>java.util.HashMap&lt;Long, String&gt; m = new java.util.HashMap&lt;Long, String&gt;();
  m.put(5L,"Five"); // compiler barfs on m.put(5, "Five")
  m.contains(5); // no complains from compiler, but returns false
  </code></pre>
  
  <p>Couldn't this have been solved by returning true if the <code>Long</code> value was withing <code>int</code> range and the values are equal?</p>