summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-02-25 11:17:53 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2019-02-25 11:17:53 +0100
commitac70a04e318b6c30a85daf02950367c34dd29226 (patch)
tree021514bec5c58dcdd73e95e4a325543cf9b737c9 /container-search
parentd3c80d67c20b23b3cff0ed49f0f6fa57bce703df (diff)
Avoid calling getFilled twice.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/HitGroup.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/result/HitGroup.java b/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
index af89220e504..7a995ef9573 100644
--- a/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
+++ b/container-search/src/main/java/com/yahoo/search/result/HitGroup.java
@@ -836,15 +836,16 @@ public class HitGroup extends Hit implements DataList<Hit>, Cloneable, Iterable<
/** Returns the set of summaries for which all concrete hits recursively below this is filled. */
@Override
public Set<String> getFilled() {
- Set<String> filled = null;
+ Set<String> intersection = null;
for (Hit hit : hits) {
- if (hit.getFilled() == null) continue;
- if (filled == null)
- filled = new HashSet<>(hit.getFilled());
+ Set<String> filled = hit.getFilled();
+ if (filled == null) continue;
+ if (intersection == null)
+ intersection = new HashSet<>(filled);
else
- filled.retainAll(hit.getFilled());
+ intersection.retainAll(filled);
}
- return filled;
+ return intersection;
}
private Iterable<Hit> fillableHits() {