private static Map<String, SimilarUsage> buildIndex(@NotNull ClusteringSearchSession session) {
    List<SimilarUsage> usages = session.getClusters().stream().flatMap(e -> e.getUsages().stream()).toList();
    return usages.stream()
      .collect(Collectors.toMap(e -> getUsageId(Objects.requireNonNull(((UsageInfo2UsageAdapter)e).getElement())), value -> value,
                                (usageId1, usageId2) ->
                                {
                                  LOG.warning("Duplicate found:" + usageId1);
                                  return usageId1;
                                }));
  }
private static Map<String, SimilarUsage> buildIndex(@NotNull ClusteringSearchSession session)