Android 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... collections)
join
return join(",", collections);
Stringjoin(String conjunction, Collection... collections)
join
int length = collections.length;
if (length == 0)
    return null;
Collection<Object> collection = (Collection<Object>) collections[0];
if (length > 1) {
    for (int i = 1; i < length; i++) {
        collection.addAll(collections[i]);
StringBuilder sb = new StringBuilder();
boolean first = true;
for (Object obj : collection) {
    if (obj == null)
        break;
    if (first)
        first = false;
    else
        sb.append(conjunction);
    sb.append(obj.toString());
return sb.toString();
StringsuffixAndJoin(String suffix, String delimiter, Collection values)
suffix And Join
String result = join(suffix + delimiter, values);
return isEmpty(result) ? result : result + suffix;
StringtoString(Collection collection, String separator)
Returns a String representation of the given collection by separating the elements with the given separator.
if (collection == null || collection.isEmpty()) {
    return "";
StringBuilder builder = new StringBuilder();
int count = collection.size();
for (Object obj : collection) {
    builder.append(obj);
    if (--count > 0) {
...
Stringjoin(Collection collection, String s)
join
String s1;
if (collection.size() == 0) {
    s1 = "";
} else {
    StringBuilder stringbuilder = new StringBuilder();
    for (Iterator iterator = collection.iterator(); iterator
            .hasNext();) {
        String s2 = (String) iterator.next();
...
Stringjoin(Collection strings, String sep)
Join a collection of strings by a seperator
return join(strings.iterator(), sep);
Stringjoin(Collection strings, String sep)
Join a collection of strings by a seperator
return join(strings.iterator(), sep);
Stringjoin(final Collection strings, String delimeter)
Convenience function for joining strings using a delimeter
if (delimeter == null) {
    delimeter = ",";
if (strings.isEmpty()) {
    return "";
StringBuffer joined = new StringBuffer();
Iterator<?> stringIter = strings.iterator();
...
Stringjoin(Collection collection, String delimiter)
Joins all items in the `collection` into a `string`, separated by the given `delimiter`.
if (collection == null)
    return "";
StringBuilder buffer = new StringBuilder();
Iterator<?> iter = collection.iterator();
while (iter.hasNext()) {
    buffer.append(iter.next());
    if (iter.hasNext()) {
        buffer.append(delimiter);
...
Stringjoin(Collection s, String delimiter)
perform join operation on specified String collection sperated by specified delimiter
if (s == null || s.isEmpty()) {
    return "";
StringBuilder builder = new StringBuilder();
Iterator<String> iter = s.iterator();
while (iter.hasNext()) {
    builder.append(iter.next());
    if (!iter.hasNext()) {
...