Here you can find the source of listStrToString(List
Parameter | Description |
---|---|
inputList | a parameter |
public static String listStrToString(List<String> inputList)
//package com.java2s; import java.util.List; public class Main { private static final String COMMA = ","; /**/* w w w.j ava2 s . c o m*/ * list -> String * list:100,200,300 - > string:100,200,300 * * @param inputList * @return */ public static String listStrToString(List<String> inputList) { if (null == inputList || inputList.isEmpty()) { return ""; } StringBuffer sb = new StringBuffer(); for (String input : inputList) { sb.append(input); sb.append(COMMA); } sb.setLength(sb.length() - 1); return sb.toString(); } }