/** * Creates a hierarchy of TreeNodes that copies the structure and content of the given tree. * * @see #copy(TreeDef, Object, Function) if you'd like to map `T` to some other type when creating the tree. */ public static <T> TreeNode<T> copy(TreeDef<T> treeDef, T root) { return copy(treeDef, root, Function.identity()); }
/** Creates a deep copy of this TreeNode. */ public TreeNode<T> copy() { return copy(treeDef(), this, TreeNode::getContent); }