List<MatchResult> (@NotNull ChooseByNameViewModel base, @NotNull FindSymbolParameters parameters, @NotNull ProgressIndicator indicator, @Nullable Supplier<String[]> allNamesProducer, String namePattern, boolean preferStartMatches) { List<MatchResult> namesList = getAllNames(base, parameters, indicator, allNamesProducer, namePattern, preferStartMatches); indicator.checkCanceled(); String pattern = parameters.getCompletePattern(); long started = System.currentTimeMillis(); namesList.sort(Comparator.comparing((MatchResult mr) -> !pattern.equalsIgnoreCase(mr.elementName)) .thenComparing((MatchResult mr) -> !namePattern.equalsIgnoreCase(mr.elementName)) .thenComparing(Comparator.naturalOrder())); if (LOG.isDebugEnabled()) { LOG.debug("sorted:"+ (System.currentTimeMillis() - started) + ",results:" + namesList.size()); } return namesList; }