代码
提交代码
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);
}
}
运行结果