将集合中对象按特定符号分隔成字符串

List<String> list =new ArrayList();

list.add(“ab”);

list.add("cd");

String str = Joiner.on(",").join(list);

最终结果:str=ab,cd

 

添加gradle依赖:compile group:'com.google.guava',name:"guava",version:20.0

posted @ 2018-02-06 15:43  samcheng  阅读(224)  评论(0编辑  收藏  举报