我有一个类似下面给出的字符串列表,我想把它转换成用胸腺叶分隔的逗号(,)。
List<String> scopeList = Arrays.asList("settings","locations","accounts","notifications");我想简单地像这样得到输出:
settings,locations,accounts,notifications发布于 2019-09-04 15:39:42
已使用CompileJava检查
//*******************************************************************
// Welcome to CompileJava!
// If you experience any issues, please contact us ('More Info') -->
//*******************************************************************
import java.util.*;
import java.util.stream.*;
// one class needs to have a main() method
public class HelloWorld
{
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
List<String> scopeList = Arrays.asList("settings","locations","accounts","notifications");
System.out.print(scopeList.stream().collect(Collectors.joining(",")));
}
}输出:
设置、位置、帐户、通知
https://stackoverflow.com/questions/57783504
复制相似问题