Here you can find the source of asString(Collection c, String separator)
public static String asString(Collection c, String separator)
//package com.java2s; import java.util.Collection; public class Main { public static String asString(Collection c, String separator) { if (c == null) { return ""; }//from www .j av a 2s . c om StringBuilder result = new StringBuilder(256); boolean needSeparator = false; for (Object o : c) { if (o == null) { continue; } String str = o.toString().trim(); if (str.equals("")) { continue; } if (needSeparator) { result.append(separator); } result.append(str); needSeparator = true; } return result.toString(); } }