Creating an instance of collection in JAVA
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/147468/why-should-the-interface-for-a-java-class-be-prefered">Why should the interface for a Java class be prefered?</a><br>
  <a href="http://stackoverflow.com/questions/3356113/what-is-the-benefit-of-polymorphism-using-collection-interface-to-create-arrayli">What is the benefit of polymorphism using Collection interface to create ArrayList object?</a>  </p>
</blockquote>



<p>I see in many examples that when one creates an instance of some collection like TreMap, he uses it's base as type:</p>

<pre><code>Map&lt;String,String&gt; theMap = new TreeMap&lt;String,String&gt;();
</code></pre>

<p>Why not to use </p>

<pre><code>TreeMap&lt;String,String&gt; theMap = new TreeMap&lt;String,String&gt;(); 
</code></pre>
