Android List Join join(List texts, String separator)

Here you can find the source of join(List texts, String separator)

Description

join

License

BSD License

Declaration

public static String join(List<?> texts, String separator) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

import java.util.List;

public class Main {
    public static String join(List<?> texts, String separator) {
        StringBuilder result = new StringBuilder();
        for (Object text : texts) {
            result.append(text);/* w  ww. j  a  v  a 2 s. com*/
            result.append(separator);
        }
        return result.toString();
    }

    public static String join(String separator, Object... texts) {
        StringBuilder result = new StringBuilder();
        boolean isFirst = true;
        for (Object text : texts) {
            if (isFirst) {
                result.append(separator);
                isFirst = false;
            }
            result.append(text);
        }
        return result.toString();
    }
}

Related

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