Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static String toString(Collection<?> list, String split) { if (list == null) { return null; } StringBuffer rs = new StringBuffer(); Iterator<?> it = list.iterator(); while (it.hasNext()) { rs.append(it.next()); if (it.hasNext()) { rs.append(split); } } return rs.toString(); } }