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 strings)
Join the strings into one string.
if (strings == null) {
    throw new NullPointerException("argument 'strings' cannot be null");
return join(strings.toArray(new String[strings.size()]));
Stringjoin(List strings)
Returns a new string created by joining each of the strings in the specified list together, with a comma between them.
String result = "";
boolean first = true;
for (String s : strings) {
    if (!first)
        result += ", ";
    result += s;
    first = false;
return result;
Stringjoin(List strings)
Join a list of strings by comma.
return join(strings.toArray(new String[0]), ", ");
Stringjoin(List strings, String delim)
join
return join(strings, 0, strings.size(), delim);
Stringjoin(List strings, String delimiter)
Join the elements of the set
if (strings == null || delimiter == null) {
    return "";
StringBuffer buf = new StringBuffer();
boolean first = true;
for (String value : strings) {
    if (first) {
        first = false;
...
Stringjoin(List strings, String join)
Join a list of strings with the given joining string.
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < strings.size(); ++i) {
    String entry = strings.get(i);
    buffer.append(entry);
    if (join != null) {
        if (i < (strings.size() - 1)) {
            buffer.append(join);
return buffer.toString();
Stringjoin(List strings, String joiner)
join
if (strings.isEmpty())
    return "";
StringBuilder sb = new StringBuilder(strings.get(0));
for (int i = 1; i < strings.size(); i++)
    sb.append(joiner).append(strings.get(i));
return sb.toString();
Stringjoin(List strings, String sep)
join
final StringBuilder buf = new StringBuilder(strings.size() * 16);
for (int i = 0; i < strings.size(); i++) {
    if (i < strings.size()) {
        buf.append(sep);
    buf.append(strings.get(i));
return buf.toString().trim();
...
Stringjoin(List strings, String separator)
join
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String string : strings) {
    if (!first) {
        sb.append(separator);
    } else {
        first = false;
    sb.append(string);
return sb.toString();
Stringjoin(List strings, String separator)
join
if (strings == null || strings.isEmpty()) {
    return "";
StringBuilder b = new StringBuilder();
for (int i = 0;; i++) {
    b.append(strings.get(i));
    if (i == strings.size() - 1) {
        return b.toString();
...