title: Why usually Map<X, X> = new HashMap<X, X>() instead of HashMap<X, X> = new HashMap<X, X>()?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3543338/isnt-it-easier-to-work-with-foo-when-it-is-represented-by-the-class-arraylist-r">Isn&#39;t it easier to work with foo when it is represented by the class ArrayList rather than the interface List?</a><br>
    <a href="https://stackoverflow.com/questions/3978702/why-are-most-of-the-examples-using-arraylist">Why are most of the examples using ArrayList</a>  </p>
  </blockquote>
  
  
  
  <p><strong>Why do we mostly do, like this</strong> : </p>
  
  <pre><code>Map&lt;Integer, String&gt; map = new HashMap&lt;Integer, String&gt;();
  </code></pre>
  
  <p><strong>instead of</strong> :</p>
  
  <pre><code>HashMap&lt;Integer, String&gt; map = new HashMap&lt;Integer, String&gt;();
  </code></pre>
  
  <p>&amp; similar while instantiating ArrayList(s).</p>