addChild

fun addChild(child: TreeNode<T>)(source)

Adds child as a direct child of this node.

Parameters

child

a node that is not already attached to a tree. To move a node that already has a parent, call detach on it first.

Throws

if child already has a parent, or if attaching it here would create a cycle (i.e. child is this node or one of its ancestors).