void (@NotNull VcsLogDataPack pack, @NotNull List<? extends RefGroup> references, @NotNull Groups actions) { for (RefGroup refGroup : references) { if (refGroup instanceof SingletonRefGroup) { VcsRef ref = ((SingletonRefGroup)refGroup).getRef(); if (isFavorite(pack, ref)) { append(actions.favoriteGroups, refGroup.getName(), ref); } else { append(actions.singletonGroups, refGroup.getName(), ref); } } else { TreeMap<String, TreeMap<String, Collection<VcsRef>>> groups = refGroup.isExpanded() ? actions.expandedGroups : actions.collapsedGroups; TreeMap<String, Collection<VcsRef>> groupActions = groups.computeIfAbsent(refGroup.getName(), key -> new TreeMap<>()); for (VcsRef ref : refGroup.getRefs()) { if (isFavorite(pack, ref)) { append(actions.favoriteGroups, ref.getName(), ref); } append(groupActions, ref.getName(), ref); } } } }