Here you can find the source of getAsString(Collection> data, char seperator)
Parameter | Description |
---|---|
data | -- the collection |
seperator | -- the separator |
public static String getAsString(Collection<?> data, char seperator)
//package com.java2s; //License from project: LGPL import java.util.Collection; import java.util.Iterator; public class Main { /**//w ww . ja v a 2s .c o m * Returns a user specified string representation of a collection * @param data -- the collection * @param seperator -- the separator * @return the collection represented as string separated by separator. */ public static String getAsString(Collection<?> data, char seperator) { Iterator<?> it = data.iterator(); boolean first = true; StringBuffer ret = new StringBuffer(); while (it.hasNext()) { if (first == false) { ret.append(seperator); } else { first = false; } ret.append(it.next().toString()); } return ret.toString(); } }