@Test
public void test1()
{
List<String> list = Arrays.asList("张三","李四","王五");
String str = String.join(",", list);
System.out.println(str);
}
@Test
public void test2()
{
List<String> list = Arrays.asList("张三","李四","王五");
String str = list.stream().collect(Collectors.joining(","));
System.out.println(str);
}
输出结果为:张三,李四,王五