@Override
    public Set<String> getFilled() {
        /*
         This is an optimisation to avoid creating many temporary hash sets in the happy path.
         The simple naive implementation is
        Set<String> filled = null;
        for (Hit hit : hits) {
            if (hit.getFilled() == null) continue;
            if (filled == null)
                filled = new HashSet<>(hit.getFilled());
            else
                filled.retainAll(hit.getFilled());
        }
        return filled;
        */
        Iterator<Hit> iterator = hits.iterator();
        Set<String> firstSummaryNames = getSummaryNamesNextFilledHit(iterator);
        if (firstSummaryNames == null || firstSummaryNames.isEmpty())
            return firstSummaryNames;

        Set<String> intersection = firstSummaryNames;
        while (iterator.hasNext()) {
            Set<String> summaryNames = getSummaryNamesNextFilledHit(iterator);
            if (summaryNames == null) continue;

            if (intersection.size() == 1)
                return getFilledSingle(intersection.iterator().next(), summaryNames, iterator);

            boolean identical = false;
            if (intersection == firstSummaryNames) {
                // Here we have detected the first inequality and we must create a modifiable set for later use of retainAll
                identical = intersection.equals(summaryNames);
                if (!identical) {
                    intersection = new HashSet<>(firstSummaryNames);
                }
            }
            if ( ! identical ) {
                intersection.retainAll(summaryNames);
            }
        }
        return intersection;
    }
Returns the set of summaries for which all concrete hits recursively below this is filled.
container-search/src/main/java/com/yahoo/search/result/HitGroup.java