List转String的几种方式

工具类使用:List 转String

List<String> test = Arrays.asList(new String[]{"1","2","3","4");
//1、StringUtils
String res1 = StringUtils.join(test.toArray(), "|");
//2、java stream
String res2 = test.stream().collect(Collectors.joining("|"));

你可能感兴趣的:(Java,list,string,stream)