title: Best way to initialize a HashMap
body: <p>I usually do e.g.  </p>
  
  <pre><code>HashMap&lt;String,String&gt; dictionary = new HashMap&lt;String,String&gt;();
  </code></pre>
  
  <p>I started to think about it, and as far as I know a <code>HashMap</code> is implemented under the hood via a hash table.<br>
  The objects are stored in the table using a hash to find where they should be stored in the table.  </p>
  
  <p>Does the fact that I do not set a size on the construction of the <code>dictionary</code> makes the performace decrease?<br>
  I.e. what would be the size of the hash table during construction? Would it need to allocate new memory for the table as elements increase?<br>
  Or I am confused on the concept here?<br>
  Are the default capacity and load adequate or should I be spending time for the actual numbers?</p>