How hashmap behaves in below scenario?
<p>Please find below code.</p>

<pre><code>Map&lt;Long,String&gt; unsortMap = new HashMap&lt;Long,String&gt;();
unsortMap.put(new Long(123), "a");
unsortMap.put(new Long(123), "ab");
</code></pre>

<p>In above case map stores only <strong>123</strong> and <strong>ab</strong>. my understanding is key-value pairs are stored in buckets. each bucket will have unique number and is decided by key's hashcode. in above code as both keys hashcodes are different, how does hashmap behaves internally?</p>

<p>Thanks!</p>
