changeset 401:d75b7d19a3df 2.8.1

StringUtils: Added method to join two String arrays. artifacts/trunk@5073 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 Jul 2012 16:42:57 +0000
parents f367be55dd35
children b4ed641f01db
files ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jul 17 19:21:08 2012 +0000
+++ b/ChangeLog	Thu Jul 19 16:42:57 2012 +0000
@@ -1,3 +1,8 @@
+2012-07-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java:
+	  Added concat() to join two String arrays.
+
 2012-07-17	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactCollection.java,
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java	Tue Jul 17 19:21:08 2012 +0000
+++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java	Thu Jul 19 16:42:57 2012 +0000
@@ -126,6 +126,16 @@
         return sb.toString();
     }
 
+    public static final String [] join(String [] a, String [] b) {
+        if (a == null && b == null) return null;
+        if (a == null) return b;
+        if (b == null) return a;
+        String [] dst = new String[a.length + b.length];
+        System.arraycopy(a, 0, dst, 0, a.length);
+        System.arraycopy(b, 0, dst, a.length, b.length);
+        return dst;
+    }
+
     public static final boolean contains(String needle, String [] haystack) {
         for (String stray: haystack) {
             if (needle.equals(stray)) {

http://dive4elements.wald.intevation.org