Java Utililty Methods Collection Join

List of utility methods to do Collection Join

Description

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

Method

Stringjoin(Collection thisPath, String _delim)
join
return join(thisPath.toArray(new String[0]), _delim);
Stringjoin(Collection values)
join
return join(values, ",");
Stringjoin(Collection words, String character)
Join all element from words list and separate them with character
if (words.isEmpty()) {
    return "";
StringBuilder wordList = new StringBuilder();
for (String word : words) {
    wordList.append(word).append(character);
String s = new String(wordList.deleteCharAt(wordList.length() - character.length()));
...
Stringjoin(Collection c, String concatinator)
Concatenates all elements in the given collection c into a single string with the separator
if (c == null)
    return "";
int size = c.size();
if (size == 0)
    return "";
Iterator<T> it = c.iterator();
StringBuilder buf = new StringBuilder();
for (int i = 0; it.hasNext() && i < size - 1; i++) {
...
Stringjoin(Collection coll, String separator)
join
if (coll == null)
    return null;
StringBuilder sb = new StringBuilder();
boolean looped = false;
for (T t : coll) {
    if (looped)
        sb.append(separator);
    sb.append(t.toString());
...
Stringjoin(Collection collec, String delimiter)
Serialize collection elements with a delimiter.
assertNotNull(delimiter);
if (collec == null)
    return null;
StringBuilder sb = new StringBuilder();
boolean first = true;
for (T t : collec) {
    if (!first) {
        sb.append(",");
...
Stringjoin(Collection collection, CharSequence joinedBy)
Joins the elements of the provided collection into a single String containing the provided list of elements.
if (collection.isEmpty()) {
    return "";
StringBuilder stringBuilder = new StringBuilder(256);
for (T t : collection) {
    stringBuilder.append(t.toString()).append(joinedBy);
return stringBuilder.substring(0, stringBuilder.length() - joinedBy.length());
...
Stringjoin(Collection collection, String joinString)
Join a collection of items into a string.
StringBuilder result = new StringBuilder();
boolean isFirst = true;
for (final T elem : collection) {
    if (!isFirst) {
        result.append(joinString);
    } else {
        isFirst = false;
    result.append(elem.toString());
return result.toString();
Stringjoin(Collection collections, String separator)
join
String result = "";
if (!collections.isEmpty()) {
    StringBuilder stringBuilder = new StringBuilder();
    for (T object : collections) {
        stringBuilder.append(object.toString()).append(separator);
    int resultLength = stringBuilder.length();
    stringBuilder.delete(resultLength - separator.length(), resultLength);
...
Stringjoin(Collection list, final String separator)
join
if (list == null) {
    return null;
final StringBuilder buf = new StringBuilder();
for (T item : list) {
    if (buf.length() > 0) {
        buf.append(separator);
    if (item != null) {
        buf.append(item);
return buf.toString();