回到首页
个人中心
反馈问题
注册登录
下载APP
代码
提交代码
import java.util.List; import java.util.stream.Stream; import java.util.stream.Collectors; public class Test{ public static void main(String...s){ List<String> collected = Stream.of("a","b","c").collect(Collectors.toList()); String formatted = collected.stream().collect(Collectors.joining(",","[","]")); System.out.println(formatted); } }
运行结果