Here you can find the source of listToString(List> list, String seperator)
Parameter | Description |
---|---|
list | a parameter |
seperator | a parameter |
public static String listToString(List<?> list, String seperator)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/* www . j av a 2 s .c om*/ * * @param list * @param seperator */ public static String listToString(List<?> list, String seperator) { return listToString(list, "", seperator, ""); } public static String listToString(List<?> list, String start, String seperator, String end) { StringBuilder builder = new StringBuilder(list.size() * 8); builder.append(start); for (int i = 0; i < list.size(); i++) { if (i > 0) builder.append(seperator); builder.append(list.get(i).toString()); } builder.append(end); return builder.toString(); } }