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 collection, String delimiter)
Joins the elements of a collection together into one string.
return join(collection, delimiter, "%s");
Stringjoin(Collection collection, String inputSeparator)
Joins the elements of the provided collection into a single string containing the provided elements.
if (collection == null) {
    return null;
String actualSeparator = inputSeparator == null ? "" : inputSeparator;
String separator = "";
StringBuilder result = new StringBuilder();
for (Object item : collection) {
    result.append(separator).append(item);
...
Stringjoin(Collection collection, String join)
Join the given collection with the given join value.
StringBuilder builder = new StringBuilder();
for (Iterator<?> iter = collection.iterator(); iter.hasNext();) {
    builder.append(iter.next());
    if (iter.hasNext()) {
        builder.append(join);
return builder.toString();
...
Stringjoin(Collection collection, String sep)
join
StringBuilder s = new StringBuilder();
for (Object obj : collection) {
    if (s.length() > 0) {
        s.append(sep);
    if (obj == null) {
        s.append("");
    } else {
...
Stringjoin(Collection collection, String separator)
Takes a collection and returns all elements assembled in a String joined by the defined separator.
String output = "";
if (collection != null) {
    Iterator<?> iterator = collection.iterator();
    while (iterator.hasNext()) {
        Object o = iterator.next();
        output += o;
        if (iterator.hasNext())
            output += separator;
...
Stringjoin(Collection collection, String separator)
join
String s = "";
for (Object item : collection) {
    s += item.toString() + separator;
return s.substring(0, s.length() - separator.length());
Stringjoin(Collection collection, String separator)
join
if (collection == null) {
    return null;
Iterator<?> it = collection.iterator();
if (!it.hasNext()) {
    return "";
Object first = it.next();
...
Stringjoin(Collection collection, String separator)
Takes a collection and returns all elements assembled in a String joined by the defined separator.
String output = "";
if (collection != null) {
    Iterator<?> iterator = collection.iterator();
    while (iterator.hasNext()) {
        Object o = iterator.next();
        output += o;
        if (iterator.hasNext())
            output += separator;
...
Stringjoin(Collection collection, String separatorString)
join
if (collection == null) {
    return null;
StringBuilder result = new StringBuilder();
Iterator<?> iterator = collection.iterator();
while (iterator.hasNext()) {
    Object next = iterator.next();
    String strValue = (next != null) ? next.toString() : "";
...
Stringjoin(Collection elements, String separator)
join
if (elements == null || elements.isEmpty()) {
    return "";
StringBuilder builder = new StringBuilder();
Iterator<?> itr = elements.iterator();
while (itr.hasNext()) {
    builder.append(itr.next());
    if (itr.hasNext()) {
...