code: public static <T, R> TreeNode<R> copy(TreeDef<T> treeDef, T root, Function<? super T, ? extends R> mapper) {
  		List<T> children = treeDef.childrenOf(root);
  		R mapped = mapper.apply(root);
  		TreeNode<R> copyRoot = new TreeNode<>(null, mapped, children.size());
  		copyRecurse(copyRoot, treeDef, root, children, mapper);
  		return copyRoot;
  	}
docs: Creates a hierarchy of TreeNodes that copies the structure and content of the given tree,
  using {@code mapper} to calculate the content of the nodes.