public static void collectOnDemandImports(@NotNull List<Import> resultList,
                                            @NotNull JavaCodeStyleSettings settings,
                                            @NotNull Map<String, Boolean> outClassesOrPackagesToImportOnDemand) {
    Object2IntMap<String> packageToCountMap = new Object2IntOpenHashMap<>();
    Object2IntMap <String> classToCountMap = new Object2IntOpenHashMap<>();
    for (Import anImport : resultList) {
      String packageOrClassName = getPackageOrClassName(anImport.name());
      if (packageOrClassName.isEmpty()) continue;
      Object2IntMap<String> map = anImport.isStatic() ? classToCountMap : packageToCountMap;
      map.put(packageOrClassName, map.getOrDefault(packageOrClassName, 0) + 1);
    }

    classToCountMap.forEach((className, count) -> {
      if (isToUseImportOnDemand(className, count, true, settings)) {
        outClassesOrPackagesToImportOnDemand.put(className, true);
      }
    });
    packageToCountMap.forEach((packageName, count) -> {
      if (isToUseImportOnDemand(packageName, count, false, settings)){
        outClassesOrPackagesToImportOnDemand.put(packageName, false);
      }
    });
  }
public static void collectOnDemandImports(@NotNull List<Import> resultList,
                                            @NotNull JavaCodeStyleSettings settings,
                                            @NotNull Map<String, Boolean> outClassesOrPackagesToImportOnDemand)