this is the interface
public interface TreeNode<T> {
public List<T> levelOrder();
public List<TreeNode<T>> getChildNodes();
public T getVal();
public void setVal(T val);
}
this is the implementation class
public class BinaryTreeNode<T> implements TreeNode<T> {
@Override
public List<BinaryTreeNode<T>> getChildNodes(){
return null;
}
}
there will be an error here,
if you change the return type to TreeNode < T > [], the implementation method can be BinaryTreeNode < T > [].
< H2 > question: < / H2 >what should I do if I want the interface to return collection classes such as List/Map instead of arrays?