List of utility methods to do Collection to String
String | toString(final Collection Returns the list of strings as a single string final StringBuilder sb = new StringBuilder(); for (final String string : list) { sb.append(string).append(delimiter); sb.setLength(sb.length() - delimiter.length()); return sb.toString(); |
String | toString(final Collection Build a string from the collection. if (c == null) { return "null"; } else if (c.isEmpty()) { return ""; StringBuilder sb = new StringBuilder(); for (T t : c) { sb.append(t.toString()); ... |
String | toString(String[] collection, char separator) GWT-ified CollectionUtils.toString .
if (collection == null) { return ""; StringBuilder builder = new StringBuilder(); for (String item : collection) { if (builder.length() > 0) { builder.append(separator); builder.append(item); return builder.toString(); |
String[] | toStrings(Collection vals) to Strings int size = vals.size(), cnt = 0; String[] strings = new String[size]; for (Iterator itr = vals.iterator(); itr.hasNext();) { String s = (String) itr.next(); if (s != null) { strings[cnt] = s; cnt++; return strings; |
List | toStrings(Collection> c) to Strings List<String> result = new ArrayList<String>(c.size()); for (Object e : c) { result.add(e.toString()); return result; |
List | toStrings(Collection Converts the given objects into a string list by invoking Object#toString() on each non-null element. List<String> strings = new ArrayList<>(); for (T t : objects) { if (t == null) { strings.add(null); } else { strings.add(t.toString()); return strings; |
String[] | toStrings(final Collection to Strings switch (stringCollection.size()) { case 0: return NO_STRINGS; case 1: return new String[] { stringCollection.iterator().next() }; default: return stringCollection.toArray(new String[stringCollection.size()]); |
String | toStringWithDelimiters(Collection objects, String delim) to String With Delimiters StringBuffer buffer = new StringBuffer(); int index = 0; for (Object obj : objects) { if (index++ > 0) buffer.append(delim); buffer.append(obj); return buffer.toString(); ... |
String | toStringWithSeparator(Collection> collection, String separator) to String With Separator if (collection.isEmpty()) return ""; StringBuilder b = new StringBuilder(); Iterator<?> it = collection.iterator(); while (true) { b.append(it.next()); if (it.hasNext()) { b.append(separator); ... |