public boolean updateRoot(Pair<? extends N, Boolean> pair) {
    N node = Pair.getFirst(pair);
    if (root == null ? node == null : root.node == node) return false;

    if (root != null) {
      remove(root, keyFunction.apply(root.node));
      root = null;
    }
    if (!map.isEmpty()) {
      map.clear();
      LOG.warn("MapBasedTree: clear lost entries");
    }
    if (node != null) {
      root = new Entry<>(path, null, node, pair.second);
      insert(root, keyFunction.apply(node));
    }
    return true;
  }
public boolean updateRoot(Pair<? extends N, Boolean> pair)