svn commit: r1760948 - /ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1760948 - /ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java

jacopoc
Author: jacopoc
Date: Thu Sep 15 15:25:50 2016
New Revision: 1760948

URL: http://svn.apache.org/viewvc?rev=1760948&view=rev
Log:
Improved: non functional minor changes to the StringUtil.split(String, String)
method (mostly formatting and unnecessary initialization and type declarations)


Modified:
    ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java

Modified: ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java?rev=1760948&r1=1760947&r2=1760948&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java (original)
+++ ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java Thu Sep 15 15:25:50 2016
@@ -135,15 +135,14 @@ public class StringUtil {
      */
     public static List<String> split(String str, String delim) {
         List<String> splitList = null;
-        StringTokenizer st = null;
+        StringTokenizer st;
 
-        if (str == null) return splitList;
+        if (str == null) return null;
 
-        if (delim != null) st = new StringTokenizer(str, delim);
-        else               st = new StringTokenizer(str);
+        st = (delim != null? new StringTokenizer(str, delim): new StringTokenizer(str));
 
-        if (st != null && st.hasMoreTokens()) {
-            splitList = new LinkedList<String>();
+        if (st.hasMoreTokens()) {
+            splitList = new LinkedList<>();
 
             while (st.hasMoreTokens())
                 splitList.add(st.nextToken());