private static @NotNull Map<PsiExpression, List<PsiVariable>> collectReusableVariables(@NotNull List<? extends PsiExpression> occurrences) {
    if (occurrences.size() <= 1) {
      return Collections.emptyMap();
    }
    Map<PsiVariable, PsiExpression> initializers = new HashMap<>();
    for (PsiExpression occurrence : occurrences) {
      PsiVariable variable = findVariableByInitializer(occurrence);
      if (variable != null) {
        initializers.put(variable, occurrence);
      }
    }
    if (initializers.isEmpty()) {
      return Collections.emptyMap();
    }

    Map<PsiExpression, List<PsiVariable>> result = new HashMap<>();
    initializers.forEach((variable, initializer) -> {
      for (PsiExpression occurrence : occurrences) {
        if (occurrence != initializer && canReplaceWith(occurrence, variable)) {
          result.computeIfAbsent(occurrence, unused -> new ArrayList<>()).add(variable);
        }
      }
    });
    return result;
  }
private static @NotNull Map<PsiExpression, List<PsiVariable>> collectReusableVariables(@NotNull List<? extends PsiExpression> occurrences)