Here you can find the source of write(Collection> c, Object separator, Object prefix, Object postfix)
public static String write(Collection<?> c, Object separator, Object prefix, Object postfix)
//package com.java2s; import java.util.Collection; public class Main { public static String write(Collection<?> c, Object separator, Object prefix, Object postfix) { StringBuilder sb = new StringBuilder(); boolean first = true; for (Object o : c) { if (!first) sb.append(separator);//from w w w . jav a2 s . c o m sb.append(prefix).append(o).append(postfix); first = false; } return sb.toString(); } }