private List<Grouping> getGroupingListForPassN(Map<Integer, Grouping> groupingMap, int pass) {
        List<Grouping> ret = new ArrayList<>();
        for (Grouping grouping : groupingMap.values()) {
            if (grouping.useSinglePass()) {
                if (pass == 0) {
                    grouping.setFirstLevel(0);
                    grouping.setLastLevel(grouping.getLevels().size());
                    ret.add(grouping); // more levels to go
                }
            } else {
                if (pass <= grouping.getLevels().size()) {
                    grouping.setFirstLevel(pass);
                    grouping.setLastLevel(pass);
                    ret.add(grouping); // more levels to go
                }
            }
        }
        return ret;
    }
Returns a list of {@link Grouping} objects that are to be used for the given pass.

@param groupingMap the map of all grouping objects
@param pass        the pass about to be performed
@return a list of grouping objects
container-search/src/main/java/com/yahoo/search/grouping/vespa/GroupingExecutor.java