TaskInfo[] () { List<R> repositories = myRepositoryManager.getRepositories(); MultiMap<String, TaskInfo> tasks = new MultiMap<>(); for (R repository : repositories) { for (TaskInfo branch : getAllBranches(repository)) { tasks.putValue(branch.getName(), branch); } } return ContainerUtil.map2Array(tasks.entrySet(), TaskInfo.class, entry -> { Set<String> repositories1 = new HashSet<>(); boolean remote = false; for (TaskInfo info : entry.getValue()) { remote |= info.isRemote(); repositories1.addAll(info.getRepositories()); } return new TaskInfo(entry.getKey(), repositories1, remote); }); }