Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { public static String implode(Iterator it) { StringBuilder sb = new StringBuilder(); while (it.hasNext()) { sb.append(it.next()); sb.append(", "); } return sb.toString().replaceAll(", +$", ""); } }