LUCENE-6827: Use explicit capacity ArrayList instead of a LinkedList in MultiFieldQueryNodeProcessor

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1707040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2015-10-06 12:43:57 +00:00
parent deb81534bc
commit 393065d27b
2 changed files with 7 additions and 13 deletions

View File

@ -172,6 +172,9 @@ Bug Fixes
Other
* LUCENE-6827: Use explicit capacity ArrayList instead of a LinkedList
in MultiFieldQueryNodeProcessor. (Dawid Weiss).
* LUCENE-6812: Upgrade RandomizedTesting to 2.1.17. (Dawid Weiss)
* LUCENE-6174: Improve "ant eclipse" to select right JRE for building.

View File

@ -17,6 +17,7 @@ package org.apache.lucene.queryparser.flexible.standard.processors;
* limitations under the License.
*/
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@ -91,32 +92,25 @@ public class MultiFieldQueryNodeProcessor extends QueryNodeProcessorImpl {
if (fields.length == 1) {
return fieldNode;
} else {
LinkedList<QueryNode> children = new LinkedList<>();
children.add(fieldNode);
List<QueryNode> children = new ArrayList<>(fields.length);
children.add(fieldNode);
for (int i = 1; i < fields.length; i++) {
try {
fieldNode = (FieldableNode) fieldNode.cloneTree();
fieldNode.setField(fields[i]);
children.add(fieldNode);
} catch (CloneNotSupportedException e) {
// should never happen
throw new RuntimeException(e);
}
}
return new GroupQueryNode(new OrQueryNode(children));
}
}
}
}
return node;
@ -126,9 +120,6 @@ public class MultiFieldQueryNodeProcessor extends QueryNodeProcessorImpl {
@Override
protected List<QueryNode> setChildrenOrder(List<QueryNode> children)
throws QueryNodeException {
return children;
}
}