Why should the interface for a Java class be prefered?
<p><a href="http://pmd.sourceforge.net/" rel="nofollow">PMD</a> would report a violation for:</p>

<pre><code>ArrayList&lt;Object&gt; list = new ArrayList&lt;Object&gt;();
</code></pre>

<p>The violation was "Avoid using implementation types like 'ArrayList'; use the interface instead".</p>

<p>The following line would correct the violation:</p>

<pre><code>List&lt;Object&gt; list = new ArrayList&lt;Object&gt;();
</code></pre>

<p>Why should the latter with <code>List</code> be used instead of <code>ArrayList</code>?</p>
