int (String tabIdx, int tabCount, Function<? super Integer, String> titleGetter) { SearchableOptionsRegistrar searchableOptionsRegistrar = SearchableOptionsRegistrar.getInstance(); for (int i = 0; i < tabCount; i++) { final Set<String> pathWords = searchableOptionsRegistrar.getProcessedWords(tabIdx); final String title = titleGetter.apply(i); if (!pathWords.isEmpty()) { final Set<String> titleWords = searchableOptionsRegistrar.getProcessedWords(title); pathWords.removeAll(titleWords); if (pathWords.isEmpty()) { return i; } } else if (tabIdx.equalsIgnoreCase(title)) { //e.g. only stop words return i; } } return -1; }