private void replaceInParent(Node<K, V> node, Node<K, V> replacement) {
    Node<K, V> parent = node.parent;
    node.parent = null;
    if (replacement != null) {
      replacement.parent = parent;
    }

    if (parent != null) {
      if (parent.left == node) {
        parent.left = replacement;
      } else {
        assert (parent.right == node);
        parent.right = replacement;
      }
    } else {
      int index = node.hash & (table.length - 1);
      table[index] = replacement;
    }
  }
Removes {@code node} from this tree, rearranging the tree's structure as
necessary.

@param unlink true to also unlink this node from the iteration linked list.
lottie/src/main/java/com/airbnb/lottie/parser/moshi/LinkedHashTreeMap.java