int (SearchEverywhereContributor contributor) { if (listElements.isEmpty()) { return 0; } List<SearchEverywhereContributor> list = contributors(); int index = list.lastIndexOf(contributor); if (index >= 0) { return isMoreElement(index) ? index : index + 1; } index = Collections.binarySearch(list, contributor, Comparator.comparingInt(SearchEverywhereContributor::getSortWeight)); return -index - 1; }