String[] (final String prefix, Editor editor) { final Matcher matcher = NameUtil.buildMatcher(prefix, 0, true, true); final Set<String> words = new HashSet<>(); CharSequence chars = editor.getDocument().getCharsSequence(); IdTableBuilding.scanWords(new IdTableBuilding.ScanWordProcessor() { @Override public void run(final CharSequence chars, char @Nullable [] charsArray, final int start, final int end) { final String word = chars.subSequence(start, end).toString(); if (matcher.matches(word)) { words.add(word); } } }, chars, 0, chars.length()); List<String> sortedWords = ContainerUtil.sorted(words); return ArrayUtilRt.toStringArray(sortedWords); }