Android List Join implode(List strings, String glue)

Here you can find the source of implode(List strings, String glue)

Description

implode

License

Open Source License

Declaration

static public String implode(List<String> strings, String glue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    static public String implode(String[] strings, String glue) {
        StringBuilder stringBuilder = new StringBuilder();
        if (strings == null)
            return "";
        for (int i = 0; i < strings.length; i++) {
            stringBuilder.append(strings[i]);
            if (i != strings.length - 1) {
                stringBuilder.append(glue);
            }//from www.j a v a  2s  .  c  om
        }
        return stringBuilder.toString();
    }

    static public String implode(List<String> strings, String glue) {
        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();
    }
}

Related

  1. join(List list, String separator)
  2. join(List strList, String separator)
  3. join(List list, String separator)
  4. join(List list, String glue)
  5. join(List s, String delimiter)
  6. join(List texts, String separator)
  7. join(String separator, List data)
  8. concatenate(List elements, String delimiter)
  9. toCommaSeperatedList(List values)