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(Object[] array)
join
return join(array, null);
Stringjoin(Object[] array)

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

No separator is added to the joined String.

return join(array, null);
Stringjoin(Object[] array, char separator)
join
if (array == null) {
    return null;
int arraySize = array.length;
int bufSize = arraySize == 0 ? 0 : ((array[0] == null ? 16 : array[0].toString().length()) + 1) * arraySize;
StringBuffer buf = new StringBuffer(bufSize);
for (int i = 0; i < arraySize; i++) {
    if (i > 0) {
...
Stringjoin(Object[] array, char separator)
Joins the elements of an array together separated by the given separator.
if (array == null) {
    return null;
return join(Arrays.asList(array), separator);
Stringjoin(Object[] array, char separator)
Join an array of Object with a given character as a separator
if (array != null)
    return join(Arrays.asList(array), ',');
else
    return "";
Stringjoin(Object[] array, char separator)
join
if (array == null) {
    return null;
return join(array, separator, 0, array.length);
Stringjoin(Object[] array, char separator, int startIndex, int endIndex)

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;
int noOfItems = endIndex - startIndex;
if (noOfItems <= 0)
    return EMPTY;
StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
    if (i > startIndex)
...
Stringjoin(Object[] array, String delim)
join the given string array with the given delimiter
return join(array, 0, array.length, delim);
Stringjoin(Object[] array, String delimiter)
join
return join(Arrays.asList(array), delimiter);
Stringjoin(Object[] array, String delimiter)
Joins elements of the defined array to a single string.
if (array == null) {
    return null;
return join(array, delimiter, 0, array.length);