Here you can find the source of joinList(List list, String separator)
public static String joinList(List list, String separator)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String joinList(List list, String separator) { StringBuilder result = new StringBuilder(); for (Object o : list) { if (o == null || o.equals("")) continue; result.append(o.toString()).append(separator); }/* ww w . jav a 2 s.c o m*/ int i = result.lastIndexOf(separator); if (i >= 0) { result.delete(i, result.length()); } return result.toString(); } }