Here you can find the source of toString(final List
Parameter | Description |
---|---|
list | List |
delimiter | Delimiter |
public static String toString(final List<String> list, char delimiter)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**/*from w w w .j av a 2 s . c o m*/ * Convert a list of strings to a string separated by delimiter * @param list List * @param delimiter Delimiter * @return String */ public static String toString(final List<String> list, char delimiter) { final StringBuilder b = new StringBuilder(); if (list != null) { for (int i = 0; i < list.size(); i++) { b.append(list.get(i)); if (i != list.size() - 1) { b.append(delimiter); } } } return b.toString(); } }