@Override
  public void integrate(Iterable<Node<?, ?>> deletedNodes, Iterable<Node<?, ?>> updatedNodes, BackDependencyIndex deltaIndex) {
    Map<ReferenceID, Set<ReferenceID>> depsToRemove = new HashMap<>();

    for (var node : deletedNodes) {
      cleanupDependencies(node, depsToRemove);
      // corner case, relevant to situations when keys in this index are actually real node IDs
      // if a node gets deleted, corresponding index key gets deleted to: this allows to ensure there is no outdated information in the index
      // If later a new node with the same ID is added, the previous index data for this ID will not interfere with the new state.
      myMap.remove(node.getReferenceID());
    }

    for (var node : updatedNodes) {
      cleanupDependencies(node, depsToRemove);
    }

    for (ReferenceID id : Iterators.unique(Iterators.flat(deltaIndex.getKeys(), depsToRemove.keySet()))) {
      Set<ReferenceID> toRemove = depsToRemove.get(id);
      Iterable<ReferenceID> toAdd = deltaIndex.getDependencies(id);
      if (!Iterators.isEmpty(toRemove)) {
        if (toAdd instanceof Set) {
          toRemove.removeAll((Set<?>)toAdd);
        }
        else {
          for (ReferenceID refId : toAdd) {
            toRemove.remove(refId);
          }
        }
        myMap.removeValues(id, toRemove);
      }
      myMap.appendValues(id, toAdd);
    }
  }
@Override
  public void integrate(Iterable<Node<?, ?>> deletedNodes, Iterable<Node<?, ?>> updatedNodes, BackDependencyIndex deltaIndex)