Here you can find the source of listToString(List
Parameter | Description |
---|
public static String listToString(List<String> list)
//package com.java2s; import java.util.List; public class Main { public static String listToString(List<String> 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 av a2 s.c o m*/ } } return sb.toString(); } }