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[] inputArray, String glueString)
Method to join array elements of type string
String output = "";
if (inputArray.length > 0) {
    StringBuilder sb = new StringBuilder();
    if (!inputArray[0].isEmpty()) {
        sb.append(inputArray[0]);
    for (int i = 1; i < inputArray.length; i++) {
        if (!inputArray[i].isEmpty()) {
...
Stringjoin(String[] items, String delimiter)
Joins string items into one string separated by delimiter.
StringBuilder result = new StringBuilder();
if (items != null)
    for (String item : items) {
        if (result.length() > 0 && !isEmpty(delimiter))
            result.append(delimiter);
        result.append(item);
return result.toString();
...
Stringjoin(String[] lines, String delim)
Returns a single string that interpolates the strings in lines by the delimiters delim.
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < lines.length; i++) {
    if (i > 0) {
        buffer.append(delim);
    buffer.append(lines[i]);
return buffer.toString();
...
Stringjoin(String[] lines, String sep)
join
StringBuilder buf = new StringBuilder();
if (lines != null)
    for (String line : lines) {
        if (buf.length() > 0) {
            buf.append(sep);
        buf.append(line);
return buf.toString();
Stringjoin(String[] lines, String separator)
join
final StringBuffer sb = new StringBuffer(256);
for (int i = 0; i < lines.length; ++i) {
    if (i != 0) {
        sb.append(separator);
    sb.append(lines[i]);
return sb.toString();
...
Stringjoin(String[] names, String sep)
Concatenate the strings in @p names, placing @p sep between each (except at the end) and return the resulting string.
if (names == null) {
    return null;
int l = names.length;
if (l < 1) {
    return "";
StringBuilder b = new StringBuilder(l * sep.length() + l + 1);
...
Stringjoin(String[] parts, String separator)
join
return join(Arrays.asList(parts), separator);
Stringjoin(String[] sentence, String separator)
join
String result = "";
for (int i = 0; i < sentence.length; i++) {
    String word = sentence[i];
    result += word + separator;
return result.trim();
Stringjoin(String[] strArr)
join
if (strArr == null)
    return null;
StringBuilder ret = new StringBuilder();
for (int i = 0, len = strArr.length; i < len; i++) {
    ret.append(strArr[i]);
    if (i < len - 1) {
        ret.append(",");
return ret.toString();
Stringjoin(String[] strArray, String delimiter)
join
StringBuilder result = new StringBuilder();
for (int i = 0, arrayLength = strArray.length; i < arrayLength; i++) {
    result.append(strArray[i]);
    if (i < arrayLength - 1) {
        result.append(delimiter);
return result.toString();
...