RepositoryDiff<List<MavenIndex>> ( @NotNull Map<String, Set<String>> remoteRepositoryIdsByUrl, @NotNull List<MavenIndex> currentRemoteIndex, @NotNull RepositoryDiffContext context) { Map<String, MavenIndex> currentRemoteIndicesByUrls = currentRemoteIndex.stream() .collect(Collectors.toMap(i -> i.getRepositoryPathOrUrl(), Function.identity())); if (currentRemoteIndicesByUrls.keySet().equals(remoteRepositoryIdsByUrl.keySet())) { return new RepositoryDiff<>(currentRemoteIndex, Collections.emptyList()); } List<MavenIndex> oldIndices = ContainerUtil .filter(currentRemoteIndex, i -> !remoteRepositoryIdsByUrl.containsKey(i.getRepositoryPathOrUrl())); List<MavenIndex> newMavenIndices = ContainerUtil.map(remoteRepositoryIdsByUrl .entrySet(), e -> { MavenIndex oldIndex = currentRemoteIndicesByUrls.get(e.getKey()); if (oldIndex != null) return oldIndex; String id = e.getValue().iterator().next(); return createMavenIndex(id, e.getKey(), IndexKind.REMOTE); }); return new RepositoryDiff<>(newMavenIndices, oldIndices); }