jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1203370 - /jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
Date Thu, 17 Nov 2011 21:13:09 GMT
Author: pmouawad
Date: Thu Nov 17 21:13:09 2011
New Revision: 1203370

URL: http://svn.apache.org/viewvc?rev=1203370&view=rev
Log:
Replace Vector by ArrayList , no need for synchronization.

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java?rev=1203370&r1=1203369&r2=1203370&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java Thu Nov 17 21:13:09
2011
@@ -26,7 +26,6 @@ import java.net.Socket;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.StringTokenizer;
-import java.util.Vector;
 
 /**
  * This class contains frequently-used static utility methods.
@@ -87,28 +86,26 @@ public final class JOrphanUtils {
                 splittee = splittee.substring(0,splittee.length()-splitLength);
             }
         }
-        Vector<String> returns = new Vector<String>();
+        List<String> returns = new ArrayList<String>();
         final int length = splittee.length(); // This is the new length
         int start = 0;
         spot = 0;
         while (start < length && (spot = splittee.indexOf(splitChar, start)) >
-1) {
             if (spot > 0) {
-                returns.addElement(splittee.substring(start, spot));
+                returns.add(splittee.substring(start, spot));
             }
             else
             {
-                returns.addElement(EMPTY_ELEMENT);
+                returns.add(EMPTY_ELEMENT);
             }
             start = spot + splitLength;
         }
         if (start < length) {
             returns.add(splittee.substring(start));
         } else if (spot == length - splitLength){// Found splitChar at end of line
-            returns.addElement(EMPTY_ELEMENT);
+            returns.add(EMPTY_ELEMENT);
         }
-        String[] values = new String[returns.size()];
-        returns.copyInto(values);
-        return values;
+        return returns.toArray(new String[returns.size()]);
     }
 
     public static String[] split(String splittee,String splitChar)



Mime
View raw message