From b13e0488cb5578e3574bbebcb8be81f1d47b4c89 Mon Sep 17 00:00:00 2001 From: Otis Gospodnetic Date: Sun, 26 Jan 2003 03:34:28 +0000 Subject: [PATCH] - Small efficiency improvement. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149939 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/document/Document.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/lucene/document/Document.java b/src/java/org/apache/lucene/document/Document.java index 1e8c447f0c7..f72d8a77836 100644 --- a/src/java/org/apache/lucene/document/Document.java +++ b/src/java/org/apache/lucene/document/Document.java @@ -153,14 +153,11 @@ public final class Document implements java.io.Serializable { } } int fieldCount = tempFieldList.size(); - if (fieldCount == 0) + if (fieldCount == 0) { return null; + } else { - Field[] fields = new Field[fieldCount]; - for (int i = 0; i < fieldCount; i++) { - fields[i] = (Field) tempFieldList.get(i); - } - return fields; + return (Field[])tempFieldList.toArray(new Field[] {}); } }