title: Initializing a HashMap with default values?
body: <p>I'm implementing the A* search algorithm given here, <a href="https://en.wikipedia.org/wiki/A" rel="noreferrer">https://en.wikipedia.org/wiki/A</a>*_search_algorithm</p>
  
  <p>This line indicates we need to initiliaze a map with the default values of INFINITY, </p>
  
  <pre><code>gScore := map with default value of Infinity
  </code></pre>
  
  <p>So I tried that here, </p>
  
  <pre><code>Map&lt;State, Double&gt; gScore = new HashMap&lt;State, Double&gt;(Double.POSITIVE_INFINITY);
  </code></pre>
  
  <p>This does not work however the following does;</p>
  
  <pre><code>Map&lt;State, Double&gt; gScore = new HashMap&lt;State, Double&gt;((int) Double.POSITIVE_INFINITY);
  </code></pre>
  
  <p>I'm wondering why, and what impact (if any) it will have on my implementation.</p>