Java tutorial
//package com.java2s; import java.util.*; public class Main { public static String join(Collection<?> coll, String delimiter) { if (coll.isEmpty()) { return ""; } Iterator<?> it = coll.iterator(); String s = String.valueOf(it.next()); while (it.hasNext()) { s += delimiter; s += String.valueOf(it.next()); } return s; } }