void (UsageInfo @NotNull [] usages) { List<UsageInfo> allUsages = new SmartList<>(usages); allUsages.addAll(myModuleInfoUsageDetector.createUsageInfosForNewlyCreatedDirs()); Map<PsiJavaModule, List<ModifyModuleStatementUsageInfo>> moduleStatementsByDescriptor = StreamEx.of(allUsages) .select(ModifyModuleStatementUsageInfo.class).groupingBy(usage -> usage.getModuleDescriptor()); modifyModuleStatements(moduleStatementsByDescriptor); }