Java Utililty Methods Collection to String

List of utility methods to do Collection to String

Description

The list of methods to do Collection to String are organized into topic(s).

Method

ListconvertEnumsToString(Collection> enums)
Converts the given enum values to their string representation.
List<String> result = new ArrayList<String>(enums.size());
for (Enum<?> value : enums) {
    result.add(value.name());
return result;
StringconvertListToString(Collection list)
convert List To String
String stringOfList = "";
if (list != null) {
    StringBuffer sb = new StringBuffer();
    boolean firstTime = true;
    for (T item : list) {
        if (firstTime) {
            sb.append(item);
            firstTime = false;
...
StringconvertString(Collection strings)
convert String
StringBuilder builder = new StringBuilder();
for (String string : strings)
    builder.append(string).append(",");
return builder.toString();
StringconvertStringCollectionToString(Collection collectionString, String delemeter)
convert String Collection To String
StringBuilder sb = new StringBuilder("");
for (String s : collectionString) {
    if (sb.length() != 0) {
        sb.append(delemeter);
    sb.append(s);
return sb.toString();
...
StringconvertStringCollectionToString(Collection value, String separator)
convert String Collection To String
if (value.size() == 0) {
    return "";
StringBuilder sb = new StringBuilder();
for (String v : value) {
    sb.append(v);
    sb.append(separator);
sb.setLength(sb.length() - separator.length());
return sb.toString();
StringconvertToString(Collection ss)
convert To String
StringBuilder sb = new StringBuilder();
for (Object i : ss) {
    sb.append(i).append(',');
return sb.toString();
StringconvertToString(final Collection objects)
convert To String
String str = "[";
boolean isNotFirst = false;
for (Object object : objects) {
    if (isNotFirst) {
        str += ", ";
    str += object;
    isNotFirst = true;
...
StringlistToString(Collection aList, String aDelimiter, boolean quoteEntries)
Create a String from the given list, where the elements are delimited with the supplied delimiter
return listToString(aList, aDelimiter, quoteEntries, '"');
StringlistToString(Collection collection)
list To String
StringBuilder out = new StringBuilder();
out.append("[");
for (Object o : collection) {
    out.append(String.format("%s ", o));
out.append("]");
return out.toString();
StringlistToString(Collection l, String delim)
list To String
StringBuilder s = new StringBuilder();
if (l.size() == 0) {
    return "";
for (Object o : l) {
    s.append(o).append(delim);
s.delete(s.length() - delim.length(), s.length());
...