Android List Join joinList(String seperator, List list)

Here you can find the source of joinList(String seperator, List list)

Description

join List

Declaration

public static String joinList(String seperator,
            List<? extends Object> list) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    public static String joinList(String seperator,
            List<? extends Object> list) {
        return joinList(seperator, list, "");
    }/*w  ww .ja  va 2s.  c  om*/

    public static String joinList(String seperator,
            List<? extends Object> list, String def) {
        if (list.isEmpty())
            return def;
        StringBuilder b = new StringBuilder();
        boolean first = true;
        for (Object s : list) {
            if (!first)
                b.append(seperator);
            b.append(s.toString());
            first = false;
        }
        return b.toString();
    }
}

Related

  1. join(List texts, String separator)
  2. join(String separator, List data)
  3. concatenate(List elements, String delimiter)
  4. toCommaSeperatedList(List values)
  5. implode(List list, String glue)
  6. joinList(String seperator, List list, String def)