Hey guys,
I have a question about the TreeNode interface. Here is the relevant code:
Code: Select all
public interface TreeNode<T> {
T getData();
List<TreeNode<T>> getChildren();
This implies, that all nodes in the tree have to have the same data type, because the node itself and also the children have the same generic type T. However, this doesn't make any sense to me. The way we are using trees, each level or even each node might have a different data type.
Is this really intended? Can it be changed?
Thank you very much in advance!