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 s)
Concatenate a Collection of Strings using the given delimiter.
if (s == null)
    return "";
StringBuilder buffer = new StringBuilder();
Iterator<?> iter = s.iterator();
while (iter.hasNext()) {
    Object item = iter.next();
    if (item != null) {
        buffer.append(item);
...
Stringjoin(Collection s, String delimiter)
Given a collection of stuff, joins their string representation into one string using delimiter
StringBuilder builder = new StringBuilder();
Iterator<?> iter = s.iterator();
while (iter.hasNext()) {
    builder.append(iter.next());
    if (!iter.hasNext()) {
        break;
    builder.append(delimiter);
...
Stringjoin(Collection s, String delimiter)
Join a string array or list with a delimiter.
StringBuilder builder = new StringBuilder();
Iterator<?> iterator = s.iterator();
while (iterator.hasNext()) {
    builder.append(iterator.next());
    if (!iterator.hasNext()) {
        break;
    builder.append(delimiter);
...
Stringjoin(Collection s, String delimiter)
join
return join(s, delimiter, null);
Stringjoin(Collection strings, String delimiter)
join
StringBuilder sb = new StringBuilder();
for (Object string : strings) {
    if (string == null) {
        string = "";
    if (sb.length() > 0) {
        sb.append(delimiter).append(string.toString());
    } else {
...
Stringjoin(Collection strings, String delimiter)
Implements join
StringBuffer buffer = new StringBuffer();
Iterator<?> iter = strings.iterator();
if (iter.hasNext()) {
    buffer.append(iter.next().toString());
    while (iter.hasNext()) {
        buffer.append(delimiter);
        buffer.append(iter.next().toString());
return buffer.toString();
Stringjoin(Collection strings, String separator)
Concatenate multiple strings by inserting a separator.
StringBuilder buf = new StringBuilder();
boolean first = true;
for (Object s : strings) {
    if (first)
        first = false;
    else
        buf.append(separator);
    buf.append(s);
...
Stringjoin(Collection strings, String separator)
Concatenate multiple strings by inserting a separator.
StringBuilder buf = new StringBuilder();
boolean first = true;
for (Object s : strings) {
    if (first) {
        first = false;
    } else {
        buf.append(separator);
    buf.append(s);
return buf.toString();
Stringjoin(Collection strings, String separator)
Concatenate multiple strings by inserting a separator.
StringBuilder buf = new StringBuilder();
boolean first = true;
for (Object s : strings) {
    if (first)
        first = false;
    else
        buf.append(separator);
    buf.append(s);
...
Stringjoin(Collection strs)
join
StringBuilder sb = new StringBuilder();
for (Object str : strs) {
    sb.append(str);
return sb.toString();