code: public final void removeChild(Node child) {
      checkState(child.parent == this, "%s is not the parent of %s", this, child);
      checkNotNull(child.previous);
  
      Node last = first.previous;
      Node prevSibling = child.previous;
      Node nextSibling = child.next;
      if (first == child) {
        first = nextSibling;
        if (nextSibling != null) {
          nextSibling.previous = last;
        }
        // last.next remains null
      } else if (child == last) {
        first.previous = prevSibling;
        prevSibling.next = null;
      } else {
        prevSibling.next = nextSibling;
        nextSibling.previous = prevSibling;
      }
  
      child.next = null;
      child.previous = null;
      child.parent = null;
    }
docs: Detach a child from its parent and siblings.