title: Difference between using Map and HashMap as declared type
body: <p>What's the difference between the following two declaration statements:</p>
  
  <pre><code>HashMap&lt;Character, Character&gt; map = new HashMap&lt;Character, Character&gt;();
  
  Map&lt;Character, Character&gt; map = new HashMap&lt;Character, Character&gt;();
  </code></pre>
  
  <p>Any advantages of using the interface <code>Map</code> instead of <code>HashMap</code> in this particular case? </p>
  
  <p>In the following case, is Map definitely better because the method can accept different types of maps?(if it is intended to) </p>
  
  <pre><code>public void method(Map map){
  
  }
  </code></pre>