遍历set集合,进行数据的拼接

 1 import org.apache.commons.lang3.StringUtils;
 2 
 3 import java.util.HashSet;
 4 import java.util.Set;
 5 
 6 public class StringUtilTest {
 7     public static void main(String[] args) {
 8         Set<String> set = new HashSet<>();
 9         set.add("a");
10         set.add("b");
11         System.out.println(StringUtils.join(set.toArray(), ","));
12     }
13 }

 

posted on 2021-02-24 15:08  放弃容易坚持一定很帅  阅读(765)  评论(0编辑  收藏  举报

导航