Java Utililty Methods ArrayList Join

List of utility methods to do ArrayList Join

Description

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

Method

Stringjoin(ArrayList list, String delimeter)
Folds the list into a string, putting the delimeter in between each element of the collection.
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size() - 1; i++) {
    sb.append(list.get(i).toString()).append(delimeter);
return sb.append(list.get(list.size() - 1).toString()).toString();
Stringjoin(ArrayList arr, String separator)
join
if (separator == null) {
    separator = ",";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.size(); i++) {
    if (i > 0) {
        sb.append(separator);
    sb.append(arr.get(i).toString());
return sb.toString();
StringJoin(ArrayList coll, String delimiter)
Join
if (coll.isEmpty())
    return "";
StringBuilder sb = new StringBuilder();
for (String x : coll)
    sb.append(x + delimiter);
sb.delete(sb.length() - delimiter.length(), sb.length());
return sb.toString();
Stringjoin(ArrayList list)
join
if ((list == null) || (list.size() == 0))
    return "";
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String item : list) {
    if (first)
        first = false;
    else
...
Stringjoin(ArrayList list, String delimiter)
join
StringBuilder stringBuilder = new StringBuilder();
Iterator<String> iterator = list.iterator();
while (iterator.hasNext()) {
    stringBuilder.append(iterator.next());
    if (!iterator.hasNext())
        break;
    stringBuilder.append(delimiter);
return stringBuilder.toString();
StringJoin(ArrayList list, String delimiter)
This method converts a list of String objects to a single String representation and inserts a delimiter between each object.
if (list.isEmpty())
    return "";
StringBuilder sb = new StringBuilder();
for (String x : list)
    sb.append(x + delimiter);
sb.delete(sb.length() - delimiter.length(), sb.length());
return sb.toString();
Stringjoin(ArrayList list, String joinChar)
join
StringBuilder sb = new StringBuilder();
int i = 0;
int size = list.size();
for (String part : list) {
    i++;
    sb.append(part);
    if (i != size) {
        sb.append(joinChar);
...
Stringjoin(ArrayList nameList, String delimiter)
Join.
String string;
StringBuilder builder;
if (nameList == null || nameList.isEmpty())
    return "";
Iterator<String> iter = nameList.iterator();
string = iter.next();
if (string.equals("")) {
    builder = new StringBuilder(iter.next());
...
Stringjoin(ArrayList s, String delimiter)
join
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < s.size(); i++) {
    if (i != 0)
        buffer.append(delimiter);
    buffer.append(s.get(i));
return buffer.toString();
Stringjoin(ArrayList strings, String separator)
Join an array
StringBuffer sb = new StringBuffer();
for (int i = 0; i < strings.size(); i++) {
    if (i != 0)
        sb.append(separator);
    sb.append(strings.get(i));
return sb.toString();