Java Visitor Pattern

  • + 1 comment

    Hey there. Can you please explain the difference between Node and Leaf? Especially in this part:

    if (childHasChild) {
                    tree = new TreeNode(values[treeNum - 1], colors[treeNum - 1], parent.getDepth() + 1);
                } else {
                    tree = new TreeLeaf(values[treeNum - 1], colors[treeNum - 1], parent.getDepth() + 1);
                }