Here you can find the source of stringListString(List
Parameter | Description |
---|---|
list | A list of Strings |
public static String stringListString(List<String> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/* w w w. j a v a 2 s . c o m*/ * Static method to generate a list representation for an ArrayList of Strings S1,...,Sn * * @param list A list of Strings * @return A String consisting of the original list of strings concatenated and separated by * commas, and enclosed by square brackets i.e. '[S1,S2,...,Sn]' */ public static String stringListString(List<String> list) { String result = "["; for (int i = 0; i < list.size() - 1; i++) { result += list.get(i) + ","; } if (list.size() > 0) { // get the generated word for the last target position result += list.get(list.size() - 1); } result += "]"; return result; } }