Java List to String listToString(List list)

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

Description

list To String

License

Apache License

Declaration

public static String listToString(List list) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {

    public static String listToString(List list) {
        StringBuilder sb = new StringBuilder();
        if (list != null && list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                if (i < list.size() - 1) {
                    sb.append(list.get(i) + ",");
                } else {
                    sb.append(list.get(i));
                }//from w  w w. j  a v a2 s .c o  m
            }
        }
        return sb.toString();
    }
}

Related

  1. listToString(List a, String separator)
  2. listToString(List inList, String delimeter)
  3. listToString(List l)
  4. listToString(List l)
  5. listToString(List list)
  6. listToString(List list)
  7. listToString(List list, char sep)
  8. listToString(List list, String delim)
  9. listToString(List list, String glue)