void (@NotNull Set<String> moduleNamesToRemove, @NotNull Collection<? extends ModifiableRootModel> otherModuleRootModels) { for (final ModifiableRootModel modifiableRootModel : otherModuleRootModels) { final OrderEntry[] orderEntries = modifiableRootModel.getOrderEntries(); for (final OrderEntry orderEntry : orderEntries) { if (orderEntry instanceof ModuleOrderEntry && moduleNamesToRemove.contains(((ModuleOrderEntry)orderEntry).getModuleName())) { modifiableRootModel.removeOrderEntry(orderEntry); } } } }