Apache Lucene open-source search software
Replace empty array with lambda expression to call Collection#toArray. (#15833)
zhouhui4a3cdbcd5f9f
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex de75aac63c3..b599dafaf4a 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -113,7 +113,7 @@ ImprovementsOptimizations----------------------* GITHUB#15681: Replace pre-sized array or empty array with lambda expression to call Collection#toArray. (Zhou Hui)+* GITHUB#15681, GITHUB#15833: Replace pre-sized array or empty array with lambda expression to call Collection#toArray. (Zhou Hui)* GITHUB#13782: Replace handwritten loops compare with Arrays.compareUnsigned in TermsEnum and TermsEnumFrame classes. (Zhou Hui)diff --git a/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java b/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.javaindex 3ac25dd93c4..6eb4b8aa1b3 100644--- a/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java+++ b/lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java@@ -159,7 +159,7 @@ final class ConjunctionDISI extends FilterDocIdSetIterator {lead1 = iterators.get(0);lead2 = iterators.get(1);- others = iterators.subList(2, iterators.size()).toArray(new DocIdSetIterator[0]);+ others = iterators.subList(2, iterators.size()).toArray(DocIdSetIterator[]::new);}private int doNext(int doc) throws IOException {diff --git a/lucene/core/src/java/org/apache/lucene/search/Explanation.java b/lucene/core/src/java/org/apache/lucene/search/Explanation.javaindex 460a20e65cb..7e9e474ecf2 100644--- a/lucene/core/src/java/org/apache/lucene/search/Explanation.java+++ b/lucene/core/src/java/org/apache/lucene/search/Explanation.java@@ -97,7 +97,7 @@ public final class Explanation {/** The sub-nodes of this explanation node. */public Explanation[] getDetails() {- return details.toArray(new Explanation[0]);+ return details.toArray(Explanation[]::new);}/** Render an explanation as text. */