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(String[] stringArray, boolean quote, String glue)
join
return join(Arrays.asList(stringArray), quote, glue);
Stringjoin(String[] stringArray, String delimiter)
join
String joinedStr = "";
if (stringArray == null || stringArray.length == 0) {
    return joinedStr;
List<String> stringList = Arrays.asList(stringArray);
return join(stringList, delimiter);
Stringjoin(String[] stringArray, String delimiterString, boolean joinNullValues)
join
List<String> list = new ArrayList<String>();
for (int i = 0; stringArray != null && i < stringArray.length; i++) {
    list.add(stringArray[i]);
return join(list, delimiterString, joinNullValues);
Stringjoin(String[] stringArray, String separator)
Concatenates the Array of Strings into a String using the separator as the delimiter.
if (stringArray == null) {
    return "";
StringBuilder result = new StringBuilder(stringArray.length * 10);
boolean needjoin = false;
for (String obj : stringArray) {
    if (needjoin) {
        result.append(separator);
...
Stringjoin(String[] strings)
join
return join(strings, null);
Stringjoin(String[] strings, char delimiter)
join
if (strings == null) {
    return null;
List<String> stringsAsList = Arrays.asList(strings);
return join(stringsAsList, delimiter);
Stringjoin(String[] strings, char delimiter)
Join string to a single string using the specified delimiter
if (strings == null) {
    return null;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < strings.length; i++) {
    if (i > 0) {
        sb.append(delimiter);
    if (strings[i] != null) {
        sb.append(strings[i]);
return sb.toString();
Stringjoin(String[] strings, String glue)
join
String result = "";
if (glue == null)
    glue = ",";
if (strings != null) {
    int counter = 0;
    for (String s : strings) {
        result += s;
        counter++;
...
Stringjoin(String[] strings, String glue)
Joins a String[] using glue to separate the elements of the array.
StringBuilder builder = new StringBuilder();
for (int i = 0; i < strings.length; i++) {
    builder.append(strings[i]);
    if (i != strings.length - 1) {
        builder.append(glue);
return builder.toString();
...
Stringjoin(String[] strings, String separator)
join
if (strings == null) {
    return null;
StringBuilder result = new StringBuilder();
boolean first = true;
for (String str : strings) {
    result.append(first ? "" : separator);
    result.append(str);
...