方法: String result =artist.stream().map(Art::getName).collect(Collectors.joining(", ", "[", "]")); (注:joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) 方法接受一个字符串序列作为拼接符,并在拼接完成后添加传递的前缀和后缀。假如我们传递的分隔符为 "-",前缀为 "[" , 后缀为 "]" 。那么输出结果为 [A-B-C-D])
标签:收集器,拼接,数组,CharSequence,字符串,java8 From: https://www.cnblogs.com/dongfangzhaoyue/p/17390036.html