Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static String toString(Collection<String> c) { StringBuilder sb = new StringBuilder(); for (String s : c) { sb.append(s).append(","); } if (sb.toString().endsWith(",")) { return sb.substring(0, sb.length() - 1); } else { return sb.toString(); } } }