title: How to cast a list of inheriting objects to a collection of objects in Java?
body: <p>I've a collection type:</p>
  
  <pre><code>Collection&lt;A&gt; collecA
  </code></pre>
  
  <p>And I've a list in my object:</p>
  
  <pre><code>List&lt;B&gt; listB
  </code></pre>
  
  <p>Where B is extending A</p>
  
  <pre><code>class B extends A { ... }
  </code></pre>
  
  <p>But I can't do the following:</p>
  
  <pre><code>collecA = listB
  </code></pre>
  
  <p>I can't understand why since Collection is implemented by List.</p>