void (List<? extends SearchEverywhereFoundElementInfo> items) { if (items.isEmpty()) { return; } items = items.stream() .sorted(myElementsComparator) .collect(Collectors.toList()); if (resultsExpired) { int lastIndex = listElements.size() - 1; listElements.clear(); if (lastIndex >= 0) fireIntervalRemoved(this, 0, lastIndex); listElements.addAll(items); if (!listElements.isEmpty()) fireIntervalAdded(this, 0, listElements.size() - 1); resultsExpired = false; } else { int startIndex = listElements.size(); listElements.addAll(items); int endIndex = listElements.size() - 1; fireIntervalAdded(this, startIndex, endIndex); if (myMaxFrozenIndex >= startIndex) myMaxFrozenIndex = startIndex - 1; // there were items for this contributor before update if (startIndex > 0) { List<SearchEverywhereFoundElementInfo> lst = myMaxFrozenIndex >= 0 ? listElements.subList(myMaxFrozenIndex + 1, listElements.size()) : listElements; lst.sort(myElementsComparator); int begin = myMaxFrozenIndex >= 0 ? myMaxFrozenIndex + 1 : 0; fireContentsChanged(this, begin, endIndex); } } reorderItemsIfApplicable(); }