List 转 string 方法 Java8自带的String.join

List a = new ArrayList<>();
a.add("aa");
a.add("bb");
String astr = String.join(",",a);
sout(astr);
拼接'' astr ="'"+String.join("','",a)+"'";
结果:aa,bb
字符串转list
List<String> listString = Arrays.asList(astr.split("','"));

你可能感兴趣的:(javaSE,java)