private static @NotNull Map<DuplicateNode, Match> filterSelectedDuplicates(@NotNull Collection<? extends DuplicateNode> selectedNodes,
                                                                             @Nullable List<Match> allDuplicates) {
    if (ContainerUtil.isEmpty(allDuplicates)) {
      return Collections.emptyMap();
    }
    Map<DuplicateNode, Match> selectedDuplicates = new HashMap<>();
    for (DuplicateNode duplicateNode : selectedNodes) {
      TextRange selectedRange = duplicateNode.getTextRange();
      if (selectedRange != null) {
        for (Match duplicate : allDuplicates) {
          PsiElement start = duplicate.getMatchStart();
          PsiElement end = duplicate.getMatchEnd();
          if (start != null && end != null &&
              selectedRange.equalsToRange(start.getTextRange().getStartOffset(), end.getTextRange().getEndOffset())) {
            selectedDuplicates.put(duplicateNode, duplicate);
            break;
          }
        }
      }
    }
    return selectedDuplicates;
  }
private static @NotNull Map<DuplicateNode, Match> filterSelectedDuplicates(@NotNull Collection<? extends DuplicateNode> selectedNodes,
                                                                             @Nullable List<Match> allDuplicates)