1: // @author Frank M. Carrano, Timothy M. Henry 2: // @version 5.0 3: private void initializeTree(T rootData, BinaryTree<T> leftTree, BinaryTree<T> rightTree) 4: { 5: root = new BinaryNode<>(rootData); 7: if ((leftTree != null) && !leftTree.isEmpty()) 8: root.setLeftChild(leftTree.root); 10: if ((rightTree != null) && !rightTree.isEmpty()) 11: { 12: if (rightTree != leftTree) 13: root.setRightChild(rightTree.root); 14: else 15: root.setRightChild(rightTree.root.copy()); 16: } // end if 18: if ((leftTree != null) && (leftTree != this)) 19: leftTree.clear(); 21: if ((rightTree != null) && (rightTree != this)) 22: rightTree.clear(); 23: } // end initializeTree