Java List to String toString(List list)

Here you can find the source of toString(List list)

Description

to String

License

Open Source License

Declaration

public static String toString(List<?> list) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    public static String toString(List<?> list) {
        StringBuilder builder = new StringBuilder();
        boolean first = true;
        builder.append("[");
        for (Object o : list) {
            if (first) {
                first = false;/*w  w  w .  jav a 2s .c o  m*/
            } else {
                builder.append(", ");
            }
            builder.append(o);
        }
        builder.append("]");
        return builder.toString();
    }
}

Related

  1. toString(List objects)
  2. toString(List col)
  3. toString(List coll, char delimiter)
  4. toString(List list)
  5. toString(List list)
  6. toString(List list)
  7. toString(List list, char sep)
  8. toString(List list, String separator)
  9. toString(List objects)