List<MavenClassSearchResult> (Project project, String pattern, int maxResult) { String patternForQuery = preparePattern(pattern); MavenIndicesManager m = MavenIndicesManager.getInstance(project); Set<MavenArtifactInfo> infos = m.getIndex() .getIndices().stream() .flatMap(i -> i.search(patternForQuery, 50).stream()) .collect(Collectors.toSet()); ArrayList<MavenClassSearchResult> results = new ArrayList<>(processResults(infos, patternForQuery, maxResult)); results.sort(Comparator.comparing(MavenClassSearchResult::getClassName)); return results; }