List<ListData> (@NotNull Collection<? extends Change> changes) { Set<ListData> result = new HashSet<>(); for (Change change : changes) { ListData list = myChangeMappings.get(change); if (list != null) { result.add(list); } else { PartialChangeTracker tracker = getChangeTrackerFor(change); if (tracker != null) { Set<ListData> affectedLists = getAffectedLists(tracker); if (change instanceof ChangeListChange) { String changeListId = ((ChangeListChange)change).getChangeListId(); ContainerUtil.addIfNotNull(result, ContainerUtil.find(affectedLists, partialList -> partialList.id.equals(changeListId))); } else { result.addAll(affectedLists); } } } } return new ArrayList<>(result); }