void (Collection<Pair<VirtualFile, AbstractVcs>> detectedRoots) { var mappings = new ArrayList<>(myMappings.getDirectoryMappings()); var knownMappedRoots = mappings.stream().map(VcsDirectoryMapping::getDirectory).collect(Collectors.toSet()); var newMappings = detectedRoots.stream() .map(pair -> new VcsDirectoryMapping(pair.component1().getPath(), pair.component2().getName())) .filter(it -> !knownMappedRoots.contains(it.getDirectory())).toList(); mappings.addAll(newMappings); setAutoDirectoryMappings(mappings); }