Java Utililty Methods List Join

List of utility methods to do List Join

Description

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

Method

Stringjoin(Collection list, String seperator)
Create a string representation of a list joined by the given separator
StringBuilder sb = new StringBuilder();
Iterator<T> iter = list.iterator();
while (iter.hasNext()) {
    sb.append(iter.next());
    if (iter.hasNext())
        sb.append(seperator);
return sb.toString();
...
Stringjoin(final List list, final String conjunction)
join
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < list.size() - 1; i++) {
    builder.append(list.get(i)).append(conjunction);
builder.append(list.size() - 1);
return builder.toString();
Stringjoin(final List toJoin)
Joins strings from list of strings, using comma as separator to one string.
return join(toJoin, ",");
Stringjoin(final List list, final CharSequence delim)
join
final StringBuffer b = new StringBuffer();
boolean skip = true;
for (final E e : list) {
    if (skip) {
        skip = false;
    } else {
        b.append(delim);
    b.append(e);
return b.toString();
Stringjoin(final List args)
join
final Iterator iterator = args.iterator();
final Object first = iterator.next();
String res;
if (!iterator.hasNext()) {
    res = String.valueOf(first);
} else {
    final StringBuilder buf = new StringBuilder(256);
    if (first != null) {
...
Stringjoin(final List list, final String separator)
join
return join(list, separator, separator, "", "");
Stringjoin(final List things, final String on)
join
final StringBuilder sb = new StringBuilder();
for (final Iterator<?> i = things.iterator(); i.hasNext();) {
    sb.append(i.next());
    if (i.hasNext()) {
        sb.append(on);
return sb.toString();
...
Stringjoin(final List list, final String delimiter)
Join objects in a list using the specified delimiter.
if (list == null || list.size() == 0) {
    return "";
StringBuffer buf = new StringBuffer();
Iterator<Object> iter = list.iterator();
if (iter.hasNext()) {
    buf.append(iter.next().toString());
while (iter.hasNext()) {
    buf.append(delimiter);
    buf.append(iter.next().toString());
return buf.toString();
Stringjoin(final List array, final String separator)
join
final StringBuilder buf = new StringBuilder(array.size() * 16);
for (String str : array) {
    buf.append(str);
    buf.append(separator);
buf.setLength(buf.length() - separator.length());
return buf.toString();
Stringjoin(final List data, String separator)
Joins elements in a list with separator.
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.size(); i++) {
    sb.append(data.get(i));
    if (i != data.size() - 1) {
        sb.append(separator);
return sb.toString();
...