Collection<ModuleRootModel> () { Map<Module, ModuleRootModel> rootModels = new HashMap<>(); for (MavenProject each : myProjectsToImportWithChanges.keySet()) { Module module = myMavenProjectToModule.get(each); ModifiableRootModel rootModel = myModelsProvider.getModifiableRootModel(module); rootModels.put(module, rootModel); } for (Module each : myModuleModel.getModules()) { if (rootModels.containsKey(each)) continue; rootModels.put(each, myModelsProvider.getModifiableRootModel(each)); } return rootModels.values(); }