code: public TreeNode<T> replace(final int index, final TreeNode<T> child) {
  		requireNonNull(child);
  		if (_children == null) {
  			throw new ArrayIndexOutOfBoundsException(format(
  				"Child index is out of bounds: %s", index
  			));
  		}
  		if (isAncestor(child)) {
  			throw new IllegalArgumentException("The new child is an ancestor.");
  		}
  
  		final TreeNode<T> oldChild = _children.set(index, child);
  		assert oldChild != null;
  		assert oldChild._parent == this;
  
  		oldChild.setParent(null);
  		child.setParent(this);
  
  		return this;
  	}
docs: Replaces the child at the give index with the given {@code child}
  
  @param index the index of the child which will be replaced
  @param child the new child
  @return {@code this} tree-node, for method chaining
  @throws ArrayIndexOutOfBoundsException  if the {@code index} is out of
  bounds
  @throws IllegalArgumentException if {@code child} is an ancestor of
  {@code this} node
  @throws NullPointerException if the given {@code child} is {@code null}