[libbluray-devel] StrUtl.Join(): use StringBuffer

hpi1 git at videolan.org
Thu May 4 09:41:06 CEST 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Apr  3 11:57:56 2017 +0300| [a105af98c077aa4d4e93c02c014b5801f673bffc] | committer: hpi1

StrUtl.Join(): use StringBuffer

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=a105af98c077aa4d4e93c02c014b5801f673bffc
---

 src/libbluray/bdj/java/org/videolan/StrUtil.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/StrUtil.java b/src/libbluray/bdj/java/org/videolan/StrUtil.java
index 43b08ed6..0fe65bdb 100644
--- a/src/libbluray/bdj/java/org/videolan/StrUtil.java
+++ b/src/libbluray/bdj/java/org/videolan/StrUtil.java
@@ -23,14 +23,16 @@ import java.util.ArrayList;
 
 public class StrUtil {
     public static String Join(String[] strings, String separator) {
-        String result = "";
         if (strings != null && strings.length > 0) {
-            result = strings[0];
+            StringBuffer buffer = new StringBuffer();
+            buffer.append(strings[0]);
             for (int i = 1; i < strings.length; i++) {
-                result = result + separator + strings[i];
+                buffer.append(separator);
+                buffer.append(strings[i]);
             }
+            return buffer.toString();
         }
-        return result;
+        return "";
     }
 
     public static String[] split(String str, char delimiter) {



More information about the libbluray-devel mailing list