public NodeState removeChild(String key) {
        if (key == null || key.length() == 0) {
            return this;
        }
        int pos = key.lastIndexOf("/");
        if (pos > -1) {
            NodeState parent = getChild(key.substring(0, pos), false);
            if (parent != null) {
                return parent.removeChild(key.substring(pos + 1));
            }
        }
        else {
            children.remove(key);
        }
        return compact();
    }
Removes the named child node from this node, and attempts to compact the system state from this node upwards by
removing empty nodes.

@param key The child to remove.
@return The result of invoking {@link #compact} after the remove.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/systemstate/rule/NodeState.java