Skip to content

Commit 7787ee0

Browse files
original-brownbearcbuescher
authored andcommitted
Save needlessly collecting list in InternalMappedSignificantTerms (elastic#112502)
No need to allocate a list+stream to do an unsafe(ish) cast.
1 parent 3ebece1 commit 7787ee0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalMappedSignificantTerms.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ protected final void writeTermTypeInfoTo(StreamOutput out) throws IOException {
7171
}
7272

7373
@Override
74+
@SuppressWarnings({ "rawtypes", "unchecked" })
7475
public Iterator<SignificantTerms.Bucket> iterator() {
75-
return buckets.stream().map(bucket -> (SignificantTerms.Bucket) bucket).toList().iterator();
76+
return (Iterator) buckets.iterator();
7677
}
7778

7879
@Override

0 commit comments

Comments
 (0)