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(List s, String delimiter)
join
int capacity = 0;
int delimLength = delimiter.length();
Iterator<? extends CharSequence> iter = s.iterator();
if (iter.hasNext()) {
    capacity += iter.next().length() + delimLength;
StringBuilder buffer = new StringBuilder(capacity);
iter = s.iterator();
...
Stringjoin(List items, String conjunction)
String.join is available only with Java 1.8.
StringBuilder sb = new StringBuilder();
boolean first = true;
for (Object x : items) {
    if (first) {
        first = false;
    } else {
        sb.append(conjunction);
    if (x == null) {
        sb.append("<null>");
    } else {
        sb.append(x.toString());
return sb.toString();
Stringjoin(List items, String separator)
join
StringBuilder sb = new StringBuilder();
for (int i = 0; i < items.size(); i++) {
    if (i > 0) {
        sb.append(separator);
    sb.append(items.get(i).toString());
return sb.toString();
...
Stringjoin(List list)
join
return join(list, DELIM);
Stringjoin(List olist, String glue)
join
return olist.toString();
Stringjoin(List valueList, String separator)
join
if (valueList == null || valueList.size() == 0) {
    throw new IllegalArgumentException("valueList might not be null or empty!");
if (separator == null) {
    throw new IllegalArgumentException("separator might not be null!");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < valueList.size(); i++) {
...
Stringjoin(List words, String iDelimiter)
Join a list of words into a single string using the specified delimiter.
StringBuilder str = new StringBuilder();
if (words.size() == 0) {
    return str.toString();
int i;
for (i = 0; i < words.size() - 1; i++) {
    str.append(words.get(i));
    str.append(iDelimiter);
...
Listjoin(List list, T element)
Creates a list that contains all elements of a given list with an additional appended element.
List<T> result = new ArrayList<T>(list.size() + 1);
result.addAll(list);
result.add(element);
return result;
Stringjoin(List _items, String _delim)
join
if (null == _items) {
    return null;
return join(_items.toArray(), _delim);
Stringjoin(List arr, String seperator)
join
StringBuilder str = new StringBuilder();
boolean isFirst = true;
for (Object item : arr) {
    if (!isFirst) {
        str.append(seperator);
    str.append(item);
    isFirst = false;
...