Here you can find the source of concat(Collection
public static <E> String concat(Collection<E> collection, String delimiter)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Iterator; public class Main { public static <E> String concat(Collection<E> collection, String delimiter) { if (collection == null) { return null; }/*from w w w . j a v a2 s .com*/ StringBuilder buf = new StringBuilder(); Iterator<E> itr = collection.iterator(); while (itr.hasNext()) { buf.append(itr.next().toString()); if (itr.hasNext()) { buf.append(delimiter); } } return buf.toString(); } }