I am implementing a tree based on this answer. According to the given simple usage example, the new nodes are named after the position whey will have in the tree, so they are variables. For example:
TreeNode<String> node0 = root.addChild("node0");
where node0 is a new TreeNode and the data the new child will have.
According to this and this I can not use a string for naming a variable.
I intend to have 26 children for each node my tree has. My question is simple, do I have to create the tree by creating by hand all the 26 possible nodes my tree will have, like below?
TreeNode<String> node0 = root.addChild("node0");
TreeNode<String> node1 = root.addChild("node1");
TreeNode<String> node2 = root.addChild("node2");
...
TreeNode<String> node25 = root.addChild("node25");
{
TreeNode<String> node00 = node0.addChild("node00");
...
{
//the above code for all the nodes of the tree
}
}
or am I missing a better solution? Thank you