LinkedHashSet<String> (Collection<String> _names) { ProgressManager.checkCanceled(); if (getPrefix().isEmpty()) { return new LinkedHashSet<>(_names); } List<String> sorted = new ArrayList<>(); for (String name : _names) { if (prefixMatches(name)) { sorted.add(name); } } ProgressManager.checkCanceled(); sorted.sort(String.CASE_INSENSITIVE_ORDER); ProgressManager.checkCanceled(); LinkedHashSet<String> result = new LinkedHashSet<>(); for (String name : sorted) { if (isStartMatch(name)) { result.add(name); } } ProgressManager.checkCanceled(); result.addAll(sorted); return result; }