Java Utililty Methods Array Join

List of utility methods to do Array Join

Description

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

Method

Stringjoin(final Object[] array, final char separator)

Joins the elements of the provided array into a single String containing the provided list of elements.

No delimiter is added before or after the list.

if (array == null) {
    return null;
return join(array, separator, 0, array.length);
Stringjoin(final String separator, final String[] array)
join
String result = null;
for (String str : array) {
    result = (result == null ? "" : result + separator) + str;
return result;
Stringjoin(final String[] arrays, final String seperator)
join
final int len = arrays.length;
if (arrays == null || len == 0) {
    return "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i++) {
    sb.append(arrays[i]);
    if (seperator != null && (i < len - 1)) {
...
Stringjoin(final String[] in, final String sep)
join
return join(Arrays.asList(in), sep);
Stringjoin(final String[] strings)
Utility method to join an array of Strings.
return Arrays.asList(strings).toString();
Stringjoin(final String[] strings, final String joinString)
join
final StringBuffer buffer = new StringBuffer();
if (strings != null && strings.length > 0) {
    buffer.append(strings[0]);
    for (int i = 1; i < strings.length; i++) {
        buffer.append(joinString);
        buffer.append(strings[i]);
return buffer.toString();
Stringjoin(final String[] values, final String delimiter)
joins list of strings using a delimiter.
if (values == null) {
    return "";
final StringBuilder result = new StringBuilder(values.length * AVERAGE_STRING_LENGTH);
for (int i = 0; i < values.length; i++) {
    result.append(values[i]);
    if (i < values.length - 1) {
        result.append(delimiter);
...
Stringjoin(final T[] array, final char c)
Join an array of objects with the given delimiter character.
return join(array, String.valueOf(c));
Stringjoin(final T[] collection)
join
return join(Arrays.asList(collection));
Stringjoin(int[] array, String separator)
Joins the given ints using the given separator into a single string.
if (array != null) {
    StringBuilder buf = new StringBuilder(Math.max(16, (separator.length() + 1) * array.length));
    char singleChar = separator.length() == 1 ? separator.charAt(0) : 0;
    for (int i = 0; i < array.length; i++) {
        if (i != 0) {
            if (singleChar != 0) {
                buf.append(singleChar);
            } else {
...