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 list, String delimiter)
Joins elements in List with a delimiter String
String out = "";
for (int i = 0; i < list.size(); i++) {
    out += list.get(i);
    if (i < list.size() - 1) {
        out += delimiter;
return out;
...
Stringjoin(List list, String flag)
join
String res = "";
if (list != null) {
    StringBuilder sb = new StringBuilder();
    int len = list.size();
    for (int i = 0; i < len; i++) {
        sb.append(flag);
        sb.append(list.get(i));
    res = sb.replace(0, 1, "").toString();
return res;
Stringjoin(List list, String separator)
join
join_sb.delete(0, join_sb.length());
for (int i = 0; i < list.size(); i++) {
    join_sb.append(list.get(i));
    if (i < list.size() - 1) {
        join_sb.append(separator);
return join_sb.toString();
...
Stringjoin(List list, String separator)
Joins string representations of all objects from list into one String Elements are converted to strings as by String.valueOf(object)
StringBuilder str = new StringBuilder();
for (Object item : list) {
    str.append(String.valueOf(item)).append(separator);
return str.substring(0, str.length() - separator.length());
Stringjoin(List objects)
Concatenate a list of objects into a single string (using their "toString" method), joining them with a ",".
return join(",", objects);
Stringjoin(List objects, String joiner)
join
return join(objects.toArray(), joiner);
Stringjoin(List strings, String delimiter)
Join string pieces and separate with a delimiter.
if (strings == null || delimiter == null) {
    return null;
StringBuffer str = new StringBuffer();
int most = strings.size() - 1;
if (strings.size() > 1) {
    Iterator iter = strings.iterator();
    for (int i = 0; i < most; i++) {
...
Stringjoin(List vec, String separator)
Return a string that contains all the list components as strings separated by the specified separator.
StringBuffer buf = new StringBuffer();
if (separator == null) {
    separator = "";
Iterator e = vec.iterator();
while (e.hasNext()) {
    buf.append(e.next().toString());
    if (e.hasNext()) {
...
Stringjoin(List items, CharSequence delimiter)
join
StringBuilder sb = new StringBuilder();
for (int i = 0; i < items.size(); i++) {
    if (i != 0)
        sb.append(delimiter);
    sb.append(items.get(i));
return sb.toString();
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();
...