void (@NotNull Collection<? extends PS> settings, @NotNull ExternalSystemSettingsListener<PS> listener) { // do not add invalid 'null' settings settings = ContainerUtil.filter(settings, ps -> ps.getExternalProjectPath() != null); List<PS> added = new ArrayList<>(); Map<String, PS> removed = new HashMap<>(myLinkedProjectsSettings); myLinkedProjectsSettings.clear(); for (PS current : settings) { myLinkedProjectsSettings.put(current.getExternalProjectPath(), current); } for (PS current : settings) { PS old = removed.remove(current.getExternalProjectPath()); if (old == null) { added.add(current); } else { checkSettings(old, current); } } if (!added.isEmpty()) { listener.onProjectsLinked(added); } if (!removed.isEmpty()) { listener.onProjectsUnlinked(removed.keySet()); } }