I have a class TreeNode:
public abstract class TreeNode<T>{
   .
   .
   .
    public Collection<TreeNode<T>> children;
    public void clear(){
       if(children == null) 
      return;
       Iterator<TreeNode<T>> iterator = children.iterator();
       while(iterator.hasNext()){
          TreeNode<T> node = iterator.next();
          node.clear();
       }
       children.clear();
   }
   .
   .
   .
}
I then have a class ListTreeNode:
public class ListTreeNode<T> extends TreeNode<T>{
   .
   .
   .
   public ListTreeNode(T data, List<ListTreeNode<T>> children){
      this.data = data;
      this.root = null;
      this.children = children;
      this.childIndex = 0;
   }
   .
   .
   .
}
I get a compiler error saying that I cannot convert from List<ListTreeNode<T>> to Collection<TreeNode<T>>. Shouldn't I be able to, since List is a subinterface of Collection and ListTreeNode is a subclass of TreeNode? Also, I have a corresponding class SetTreeNode which uses Set instead of List and there are no errors in its corresponding constructor where I have this.children = children; .
 
     
     
    