Predicate<CommitId> (@NotNull final Collection<? extends CommitId> heads) { List<Integer> headIds = ContainerUtil.map(heads, head -> myPermanentCommitsInfo.getNodeId(head)); if (!heads.isEmpty() && ContainerUtil.getFirstItem(heads) instanceof Integer) { IntSet branchNodes = new IntOpenHashSet(); myReachableNodes.walkDown(headIds, node -> branchNodes.add(((Integer)myPermanentCommitsInfo.getCommitId(node)).intValue())); return new IntContainedInBranchCondition<>(branchNodes); } else { final Set<CommitId> branchNodes = new HashSet<>(); myReachableNodes.walkDown(headIds, node -> branchNodes.add(myPermanentCommitsInfo.getCommitId(node))); return new ContainedInBranchCondition<>(branchNodes); } }