Here you can find the source of toString(List
public static String toString(List<String> input, String sep)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String toString(List<String> input, String sep) { if (input.isEmpty()) return ""; String result = input.get(0); for (int i = 1; i < input.size(); i++) { result += sep + input.get(i); }/* w ww . ja v a2 s . co m*/ return result; } }