Here you can find the source of implode(Iterator it)
public static String implode(Iterator it)
//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());//from w w w . j a v a 2 s. c o m sb.append(", "); } return sb.toString().replaceAll(", +$", ""); } }