Here you can find the source of toString(Collection> objects, CharSequence delimiter)
public static String toString(Collection<?> objects, CharSequence delimiter)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static String toString(Collection<?> objects, CharSequence delimiter) { StringBuilder sb = new StringBuilder(); for (Object o : objects) { sb.append(o.toString());/*www. j a v a 2 s .c o m*/ sb.append(delimiter); } sb.setLength(sb.length() - delimiter.length()); return sb.toString(); } }