Here you can find the source of getCollectionStringBySplit(Collection collection, String split)
@SuppressWarnings("rawtypes") public static String getCollectionStringBySplit(Collection collection, String split)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { @SuppressWarnings("rawtypes") public static String getCollectionStringBySplit(Collection collection, String split) { return getArrayStringBySplit(collection.toArray(), split); }//from ww w .jav a 2 s . c om public static String getArrayStringBySplit(Object[] collection, String split) { StringBuffer buf = new StringBuffer(); if (split == null || split.length() == 0) { split = ","; } for (Object obj : collection) { buf.append(obj).append(split); } if (buf.toString().endsWith(split)) return buf.substring(0, buf.length() - 1); return buf.toString(); } }