Java Utililty Methods String Join

List of utility methods to do String Join

Description

The list of methods to do String Join are organized into topic(s).

Method

Stringjoin(String delimiter, Collection objects)
Joins a collection of objects with given delimiter.
StringBuilder sb = new StringBuilder();
for (Object part : objects) {
    sb.append(part.toString()).append(delimiter);
if (sb.length() > delimiter.length()) {
    sb.delete(sb.length() - delimiter.length(), sb.length());
return sb.toString();
...
Stringjoin(String delimiter, Collection items)
Join one or more items placing the specified delimiter between each item
StringBuilder buffer = new StringBuilder();
if (delimiter == null) {
    delimiter = "";
if (items != null) {
    for (String item : items) {
        if (item != null) {
            buffer.append(item);
...
Stringjoin(String delimiter, Iterable elements)
Join a list of elements into a single string with the specified delimiter.
if (delimiter == null) {
    delimiter = "";
StringBuilder sb = new StringBuilder();
for (String element : elements) {
    if (!isEmpty(element)) {
        if (sb.length() > 0) {
            sb.append(delimiter);
...
Stringjoin(String delimiter, Iterable strings)
Joins the given Strings together using the delimiter
String del = "";
StringBuilder sb = new StringBuilder();
for (String token : strings) 
    sb.append(del).append(token);
    del = delimiter;
return sb.toString();
...
Stringjoin(String delimiter, Iterable strings)
join
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String str : strings) {
    if (first) {
        first = false;
    } else {
        sb.append(delimiter);
    sb.append(str);
return sb.toString();
Stringjoin(String delimiter, Object... objects)
join
return join(delimiter, Arrays.asList(objects));
Stringjoin(String delimiter, Object... parts)
join
return join(Arrays.asList(parts), delimiter);
Stringjoin(String delimiter, String... items)
join
return join(delimiter, Arrays.asList(items));
Stringjoin(String delimiter, String... params)
Joins the given params using delimiter.
return join(delimiter, Arrays.asList(params));
Stringjoin(String delimiter, String... strings)
Joins the given strings.
if (strings == null || strings.length == 0) {
    return null;
} else {
    StringBuilder result = new StringBuilder(strings[0]);
    for (int i = 1; i < strings.length; i++) {
        result.append(delimiter);
        result.append(strings[i]);
    return result.toString();