private static @NotNull Collection<GitLocalBranch> getBranches(@Nullable GitRepository repository,
                                                                 @NotNull Map<GitRepository, Set<GitLocalBranch>> branchCollection) {
    if (repository != null) {
      return Objects.requireNonNullElse(branchCollection.get(repository), Collections.emptySet());
    }
    return StreamEx.of(branchCollection.values()).flatMap(Set::stream).collect(Collectors.toSet());
  }
private static @NotNull Collection<GitLocalBranch> getBranches(@Nullable GitRepository repository,
                                                                 @NotNull Map<GitRepository, Set<GitLocalBranch>> branchCollection)