Java List to String listToString(List list)

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

Description

list To String

License

Open Source License

Parameter

Parameter Description
list a parameter

Declaration

public static String listToString(List<?> list) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    /**//from   w w  w. j  a  v  a2  s  .c o  m
     * @param list
     * @return
     */
    public static String listToString(List<?> list) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            sb.append(list.get(i) + ",");
        }
        if (sb.toString().endsWith(","))
            return sb.substring(0, sb.length() - 1);
        return sb.toString();
    }
}

Related

  1. listToString(List collection)
  2. listToString(List items)
  3. listToString(List l, String delim)
  4. listToString(List l, String sep)
  5. listToString(List list)
  6. listToString(List list, String separator, String prefix, String suffix)
  7. listToString(List list, String seperator)
  8. listToString(List list)
  9. listToString(List list)