Collection<LocalChangeListImpl> (@NotNull List<LocalChangeListImpl> lists) { // workaround for loading incorrect settings (with duplicate changelist names) boolean hasDefault = false; Map<String, LocalChangeListImpl> map = new HashMap<>(); for (LocalChangeListImpl list : lists) { if (list.isDefault() && hasDefault) { list = new LocalChangeListImpl.Builder(list).setDefault(false).build(); } hasDefault |= list.isDefault(); LocalChangeListImpl otherList = map.get(list.getName()); if (otherList != null) { list = new LocalChangeListImpl.Builder(otherList) .setChanges(ContainerUtil.union(list.getChanges(), otherList.getChanges())) .setDefault(list.isDefault() || otherList.isDefault()) .build(); } map.put(list.getName(), list); } return map.values(); }