Here you can find the source of toString(List
public static String toString(List<String> list, String split)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String toString(List<String> list, String split) { StringBuffer sbuf = new StringBuffer(); for (int i = 0; i < list.size(); i++) { if (i > 0) { sbuf.append(split);/*from w ww . j ava 2 s .c o m*/ } sbuf.append(list.get(i)); } return sbuf.toString(); } }