private void clearRemovedBuildTargets(Map<String, Map<String, BuildTargetState>> targetsMap) {
    Map<String, List<String>> allTargets = new HashMap<>();
    for (BuildTarget<?> it : myBuildTargetIndex.getAllTargets()) {
      String id = it.getId();
      allTargets.computeIfAbsent(it.getTargetType().getTypeId(), k -> new ArrayList<>()).add(id);
    }
    targetsMap.keySet().removeIf(targetTypeId -> !allTargets.containsKey(targetTypeId));
    for (Map.Entry<String, Map<String, BuildTargetState>> entry : targetsMap.entrySet()) {
      String targetTypeId = entry.getKey();
      Map<String, BuildTargetState> targetStates = entry.getValue();
      targetStates.keySet().removeIf(targetId -> !allTargets.get(targetTypeId).contains(targetId));
    }
  }
private void clearRemovedBuildTargets(Map<String, Map<String, BuildTargetState>> targetsMap)