commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r430240 - /jakarta/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/CSVUtils.java
Date Thu, 10 Aug 2006 04:49:06 GMT
Author: bayard
Date: Wed Aug  9 21:49:05 2006
New Revision: 430240

URL: http://svn.apache.org/viewvc?rev=430240&view=rev
Log:
Optimisation from Ortwin Glueck (#SANDBOX-166) in which empty String arrays are replaced with
constants. 

Modified:
    jakarta/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/CSVUtils.java

Modified: jakarta/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/CSVUtils.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/CSVUtils.java?rev=430240&r1=430239&r2=430240&view=diff
==============================================================================
--- jakarta/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/CSVUtils.java (original)
+++ jakarta/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/CSVUtils.java Wed Aug
 9 21:49:05 2006
@@ -24,6 +24,9 @@
  */
 public class CSVUtils {
 
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+    private static final String[][] EMPTY_DOUBLE_STRING_ARRAY = new String[0][0];
+
     /**
      * <p><code>CSVUtils</code> instances should NOT be constructed in
      * standard programming. 
@@ -86,7 +89,7 @@
     if (result == null) {
       // since CSVStrategy ignores empty lines an empty array is returned
       // (i.e. not "result = new String[][] {{""}};")
-      result = new String[0][0];
+      result = EMPTY_DOUBLE_STRING_ARRAY;
     }
     return result;
   }
@@ -108,7 +111,7 @@
     }
     // uh,jh: make sure that parseLine("").length == 0
     if (s.length() == 0) {
-      return new String[0];
+      return EMPTY_STRING_ARRAY;
     }
     return (new CSVParser(new StringReader(s))).getLine();
   }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message