List<CommittedChangeList> (@NotNull RepositoryLocationGroup group) { List<CommittedChangeList> result = new ArrayList<>(); List<CommittedChangeList> equalLists = new ArrayList<>(); CommittedChangeList previousList = null; for (CommittedChangeList list : Iterables.mergeSorted(collectChangeLists(group.getLocations()), myComparator)) { if (previousList != null && myComparator.compare(previousList, list) != 0) { result.add(zip(group, equalLists)); equalLists.clear(); } equalLists.add(list); previousList = list; } if (!equalLists.isEmpty()) { result.add(zip(group, equalLists)); } return result; }