public TreeNode<T> remove(final int index) {
		if (_children == null) {
			throw new ArrayIndexOutOfBoundsException(format(
				"Child index is out of bounds: %s", index
			));
		}

		final TreeNode<T> child = _children.remove(index);
		assert child._parent == this;
		child.parent(null);

		if (_children.isEmpty()) {
			_children = null;
		}

		return this;
	}
Removes the child at the specified index from this node's children and
sets that node's parent to {@code null}.

@param index the index in this node's child array of the child to remove
@return {@code this} tree-node, for method chaining
@throws ArrayIndexOutOfBoundsException  if the {@code index} is out of
        bounds
jenetics.ext/src/main/java/io/jenetics/ext/util/TreeNode.java