Here you can find the source of listToString(List> list)
Parameter | Description |
---|---|
list | a parameter |
public static String listToString(List<?> list)
//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(); } }