I have this tree structure
sealed trait Tree
case class Node(var left: Tree, var right: Tree, var value: String) extends Tree
case object EmptyNode extends Tree
and a Tree object called myTree. I want to make another tree with the exact same structure and values called otherTree, but myTree.clone() does not work. What else can I do?
Something like this will copy your
Tree
: