You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by mg...@apache.org on 2013/06/18 22:35:00 UTC
svn commit: r1494288 -
/cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
Author: mgentry
Date: Tue Jun 18 20:35:00 2013
New Revision: 1494288
URL: http://svn.apache.org/r1494288
Log:
Added join() utility method.
Modified:
cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
Modified: cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java?rev=1494288&r1=1494287&r2=1494288&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java (original)
+++ cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java Tue Jun 18 20:35:00 2013
@@ -125,6 +125,29 @@ public class Util {
}
/**
+ * @param strings The list of strings to join.
+ * @param separator The separator between the strings.
+ * @return A single string of all the input strings separated by the separator.
+ */
+ public static String join(List<String> strings, String separator) {
+ if (strings == null || strings.size() == 0)
+ return "";
+
+ if (separator == null)
+ separator = "";
+
+ StringBuilder builder = new StringBuilder();
+
+ for (String string : strings) {
+ if (builder.length() > 0)
+ builder.append(separator);
+ builder.append(string);
+ }
+
+ return builder.toString();
+ }
+
+ /**
* Copies file contents from source to destination. Makes up for the lack of file
* copying utilities in Java
*