List<Module> () { List<Module> remainingModules = new ArrayList<>(); Collections.addAll(remainingModules, myModuleModel.getModules()); for (MavenProject each : selectProjectsToImport(myAllProjects)) { remainingModules.remove(myMavenProjectToModule.get(each)); } List<Module> obsolete = new ArrayList<>(); final MavenProjectsManager manager = MavenProjectsManager.getInstance(myProject); for (Module each : remainingModules) { if (manager.isMavenizedModule(each) && myPreviewModule != each) { obsolete.add(each); } } return obsolete; }