|
@@ -240,14 +240,14 @@ public class StringUtil { |
|
|
* @param delim the delimiter character(s) to use. (null value will join with no delimiter) |
|
|
* @param delim the delimiter character(s) to use. (null value will join with no delimiter) |
|
|
* @return a String of all values in the list seperated by the delimiter |
|
|
* @return a String of all values in the list seperated by the delimiter |
|
|
*/ |
|
|
*/ |
|
|
public static String join(Collection<String> list, String delim) { |
|
|
|
|
|
|
|
|
public static String join(Collection<? extends Object> list, String delim) { |
|
|
if (list == null || list.size() < 1) |
|
|
if (list == null || list.size() < 1) |
|
|
return null; |
|
|
return null; |
|
|
StringBuffer buf = new StringBuffer(); |
|
|
StringBuffer buf = new StringBuffer(); |
|
|
Iterator i = list.iterator(); |
|
|
Iterator i = list.iterator(); |
|
|
|
|
|
|
|
|
while (i.hasNext()) { |
|
|
while (i.hasNext()) { |
|
|
buf.append((String) i.next()); |
|
|
|
|
|
|
|
|
buf.append(i.next().toString()); |
|
|
if (i.hasNext()) |
|
|
if (i.hasNext()) |
|
|
buf.append(delim); |
|
|
buf.append(delim); |
|
|
} |
|
|
} |
|
|