List of utility methods to do Collection to String
String | collectionToDelimitedString(Collection> coll, String delim) Convert a Collection into a delimited String (e.g. return collectionToDelimitedString(coll, delim, "", ""); |
String | collectionToDelimitedString(Collection> coll, String delim) Convenience method to return a Collection as a delimited (e.g. return collectionToDelimitedString(coll, delim, "", ""); |
String | collectionToDelimitedString(Collection> coll, String delim, String prefix, String suffix) Convenience method to return a Collection as a delimited (e.g. if (coll == null || coll.isEmpty()) { return ""; StringBuilder sb = new StringBuilder(); Iterator<?> it = coll.iterator(); while (it.hasNext()) { sb.append(prefix).append(it.next()).append(suffix); if (it.hasNext()) { ... |
String | collectionToDelimitedString(Collection collection To Delimited String StringBuffer str = new StringBuffer(); for (String val : values) { if (str.length() > 0) { str.append(delimiter); str.append(val); return str.toString(); ... |
String | collectionToStr(Collection> collection) collection To Str return collectionToStr(collection, null, null, null, true);
|
String | CollectionToStr(Collection Collection To Str StringBuffer sb = new StringBuffer(); int i = 0; for (String string : coll) { if (i > 0) { sb.append(","); i++; sb.append(string); ... |
String | collectionToStr(Collection collection To Str StringBuilder result = new StringBuilder(""); if (collection == null) { return result.toString(); T[] array = (T[]) collection.toArray(); for (int i = 0; i < array.length; i++) { result.append(array[i]); if (i != array.length - 1) { ... |
String | collectionToString(Collection extends Object> collection) Transform a collection of objects to a whitespace delimited String. return toStringBuilder(collection, " ").toString(); |
String | collectionToString(@SuppressWarnings("rawtypes") Collection coll) Take a collection of anything and return it formatted as a string. if (coll == null) return ""; StringBuffer sb = new StringBuffer(); sb.append("["); for (Object o : coll) { sb.append(o.toString()); sb.append(","); sb.append("]"); return sb.toString(); |
String | collectionToString(Collection c) collection To String StringBuffer buff = new StringBuffer(); int i = 0; int size = c.size(); for (Iterator iter = c.iterator(); iter.hasNext();) { Object object = iter.next(); if (size > 1 && i == (size - 1)) { buff.append("and "); buff.append(object); if (i < (size - 1)) { if (size > 2) { buff.append(", "); } else { buff.append(" "); i++; return buff.toString(); |