Android Utililty Methods List Join

List of utility methods to do List Join

Description

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

Method

Stringjoin(List list, String separator, boolean ignoreNull)
join
if (list.isEmpty())
    return "";
StringBuilder b = new StringBuilder();
for (String item : list) {
    if (!ignoreNull || item != null) {
        b.append(separator).append(item);
if (b.length() == 0) {
    return "";
return b.toString().substring(separator.length());
Stringjoin(List list, String separator)
join
StringBuilder builder = new StringBuilder();
for (int i = 0; i < list.size(); i++) {
    builder.append(list.get(i));
    if (i < list.size() - 1) {
        builder.append(separator);
return builder.toString();
...
Stringjoin(List strList, String separator)
join
StringBuilder sb = new StringBuilder();
if (strList != null && !strList.isEmpty()) {
    boolean isFirst = true;
    for (String str : strList) {
        if (isFirst) {
            isFirst = false;
        } else {
            sb.append(separator);
...
Stringjoin(List list, String separator)
join
return join(list, separator, false);
Stringjoin(List list, String glue)
join
return join(list.toArray(new String[0]), glue);
Stringjoin(List s, String delimiter)
join
if (s == null || s.isEmpty()) {
    return "";
Iterator<String> iter = s.iterator();
StringBuilder builder = new StringBuilder(iter.next());
while (iter.hasNext()) {
    builder.append(delimiter).append(iter.next());
return builder.toString();
Stringimplode(List strings, String glue)
implode
StringBuilder stringBuilder = new StringBuilder();
if (strings == null)
    return "";
for (int i = 0; i < strings.size(); i++) {
    stringBuilder.append(strings.get(i));
    if (i != strings.size() - 1) {
        stringBuilder.append(glue);
return stringBuilder.toString();
Stringjoin(List texts, String separator)
join
StringBuilder result = new StringBuilder();
for (Object text : texts) {
    result.append(text);
    result.append(separator);
return result.toString();
Stringjoin(String separator, List data)
join
StringBuilder sb = new StringBuilder();
for (String item : data) {
    if (sb.length() > 0)
        sb.append(separator);
    sb.append(item);
return sb.toString();
Stringconcatenate(List elements, String delimiter)
concatenate
StringBuilder out = new StringBuilder();
for (int i = 0; i < elements.size(); i++) {
    String element = elements.get(i);
    if (i > 0) {
        out.append(delimiter);
    out.append(element);
return out.toString();