Collection<String> (Collection<? extends GitRepository> repositories, boolean local) { Collection<String> names; if (local) { names = convertBranchesToNames(getCommonLocalBranches(repositories)); } else { names = getBranchNamesWithoutRemoteHead(getCommonRemoteBranches(repositories)); } return StreamEx.of(names).sorted(StringUtil::naturalCompare).toList(); }