标签:
public static String listToString(List<String> stringList){
if (stringList==null) {
return null;
}
StringBuilder result=new StringBuilder();
result.append("(");
boolean flag=false;
for (String string : stringList) {
if (flag) {
result.append(",");
}else {
flag=true;
}
result.append("‘");
result.append(string);
result.append("‘");
}
result.append(")");
return result.toString();
}
public static void main(String[] args) {
List<String> list=new ArrayList<String>();
list.add("aaa");
list.add("bbb");
list.add("ccc");
System.out.println(listToString(list));//aaa,bbb,ccc
}
标签:
原文地址:http://www.cnblogs.com/yuyue2014/p/4825402.html