Java Utililty Methods List to String

List of utility methods to do List to String

Description

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

Method

StringtoString(final Object[] list)
Returns a readable presentation of an Object array.
final StringBuffer buffer = new StringBuffer(30);
buffer.append("(");
if (list != null) {
    for (int i = 0; i < list.length; i++) {
        if (i > 0) {
            buffer.append(", ");
        if (list[i] instanceof CharSequence) {
...
StringtoString(List arguments)
Takes a list and returns a space separated string with the string values of each list element.
StringBuffer buffer = new StringBuffer();
for (Iterator iter = arguments.iterator(); iter.hasNext();) {
    String element = iter.next().toString();
    buffer.append(element);
    if (iter.hasNext()) {
        buffer.append(' ');
return buffer.toString();
StringtoString(List l)
to String
StringBuffer buf = new StringBuffer();
for (int i = 0; i < l.size() - 1; i++) {
    buf.append(l.get(i).toString());
    buf.append("\t");
buf.append(l.get(l.size() - 1).toString());
return buf.toString();
StringtoString(List list)
to String
return Arrays.toString(list.toArray());
StringtoString(List list)
Builds a string containing the names of each list element separated by comma.
String result = "";
for (Iterator<? extends Object> it = list.iterator(); it.hasNext();) {
    Object obj = it.next();
    if (it.hasNext()) {
        result += obj.toString() + ", ";
    } else {
        result += obj.toString();
return result;
ListtoString(List objects)
this method converts any List to a list of strings.
List<String> strings = new ArrayList<String>();
for (Object object : objects) {
    strings.add(object.toString());
return strings;
StringtoString(List col)
to String
StringBuilder buf = new StringBuilder();
buf.append("[");
boolean first = true;
for (Object o : col) {
    if (first) {
        first = false;
    } else {
        buf.append(", ");
...
StringtoString(List coll, char delimiter)
to String
StringBuilder builder = new StringBuilder();
for (int i = 0; i < coll.size(); i++) {
    builder.append(coll.get(i));
    if (i < coll.size() - 1)
        builder.append(delimiter);
return builder.toString();
StringtoString(List list)
to String
if (list == null) {
    return "null";
String listStr = "";
for (Object obj : list) {
    listStr += obj.toString() + ", ";
listStr = trimLastSeperator(listStr, ", ");
...
StringtoString(List list)
to String
String s = "";
for (int i = 0; i < list.size(); i++) {
    if (i > 0)
        s += ", ";
    Object o = list.get(i);
    s += o.toString();
return s;
...