title: Java: collection that cannot be converted to List
body: <p>In the following code I get an error saying that collection cannot be converted to List. Why not? I thought when the method saveObject is called the part</p>
  
  <pre><code>List e = c;
  </code></pre>
  
  <p>equals </p>
  
  <pre><code>List e = ArrayList();
  </code></pre>
  
  <p>because c - although of type Collection - refers to ArrayList in the end</p>
  
  <p>Code:</p>
  
  <pre><code>import java.util.*;
  class Test {
  int i;
  Object prevObject;
  public void saveObject(List e) {
      prevObject = e;
      i++;
  }
  
  public static void main (String[] args) {
      Test t = new Test();
      Collection c = new ArrayList();
      t.saveObject(c);
      }
  }
  </code></pre>