From b7e6ca1fe014e727f37d5f279e70aa0f0af6f611 Mon Sep 17 00:00:00 2001 From: Erich Schubert Date: Mon, 15 May 2017 11:00:57 +0200 Subject: [PATCH] Allocate ArrayList with exact size --- .../src/java/org/apache/lucene/search/ExactPhraseScorer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java b/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java index 002375d161b2..7decc7b46900 100644 --- a/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java +++ b/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java @@ -53,8 +53,8 @@ public PostingsAndPosition(PostingsEnum postings, int offset) { this.docScorer = docScorer; this.needsScores = needsScores; - List iterators = new ArrayList<>(); - List postingsAndPositions = new ArrayList<>(); + List iterators = new ArrayList<>(postings.size()); + List postingsAndPositions = new ArrayList<>(postings.size()); for(PhraseQuery.PostingsAndFreq posting : postings) { iterators.add(posting.postings); postingsAndPositions.add(new PostingsAndPosition(posting.postings, posting.position));