Here you can find the source of listToString(List
public static String listToString(List<String> list, String delimiter)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String listToString(List<String> list, String delimiter) { String ret = ""; for (int i = 0; i < list.size(); i++) { if (i < list.size() - 1) { ret += list.get(i) + delimiter; } else { ret += list.get(i);//from w w w . j av a 2 s .co m } } return ret; } }