Here you can find the source of collectionToString(Collection c, String spilt)
public static final String collectionToString(Collection c, String spilt)
//package com.java2s; /**// w w w . ja v a 2 s .c o m * Converts a line of text into an array of lower case words using a * BreakIterator.wordInstance(). <p> * * This method is under the Jive Open Source Software License and was * written by Mark Imbriaco. * * @param text a String of text to convert into an array of words * @return text broken up into an array of words. */ import java.util.ArrayList; import java.util.Collection; public class Main { /** * Formats a Date as a fifteen character long String made up of the Date's * padded millisecond value. * * @return a Date encoded as a String. */ public static final String collectionToString(Collection c, String spilt) { if (c == null) { return null; } if (spilt == null) { return null; } String ret = ""; ArrayList a = new ArrayList(c); try { for (int i = 0; i < a.size(); i++) { String t = (String) a.get(i); if (i == a.size() - 1) { ret = ret + t; } else { ret = ret + t + spilt; } } return ret; } catch (Exception e) { e.printStackTrace(); return null; } } }