private static void mergeDuplicateUsages(@NotNull List<? extends ClusterOfUsages> usagesList, @NotNull List<Match> matches) {
    Set<ClusterOfUsages> duplicateUsages = new HashSet<>();
    for (int i = 0; i < usagesList.size(); i++) {
      ClusterOfUsages usages = usagesList.get(i);
      if (duplicateUsages.contains(usages)) continue;

      for (int j = i + 1; j < usagesList.size(); j++) {
        ClusterOfUsages otherUsages = usagesList.get(j);

        if (usages.isEquivalent(otherUsages, matches)) {
          for (Match match : matches) {
            ExtractedParameter parameter = usages.getParameter(match);
            ExtractedParameter otherParameter = otherUsages.getParameter(match);
            if (parameter != null && otherParameter != null) {
              parameter.addUsages(otherParameter.myPattern);
              match.getExtractedParameters().remove(otherParameter);
            }
          }
          duplicateUsages.add(otherUsages);
        }
      }
    }
    usagesList.removeAll(duplicateUsages);
  }
private static void mergeDuplicateUsages(@NotNull List<? extends ClusterOfUsages> usagesList, @NotNull List<Match> matches)