Collection<String> (final GlobalSearchScope scope, final MultiMap<String, Module> map) { if (scope == null) return map.keySet(); List<String> result = new SmartList<>(); for (final String prefix : map.keySet()) { modules: for (final Module module : map.get(prefix)) { if (scope.isSearchInModuleContent(module)) { result.add(prefix); break modules; } } } return result; }