字符串List<String>各种操作

1、打印List<String> 日志,用, 进行分割

String collect = ibds.stream()
            .collect(Collectors.joining(","));

测试

List<String> ibds = new ArrayList<String>();
ibds.add("a1");
ibds.add("a2");
ibds.add("a3");
ibds.add("a4");
String collect = ibds.stream()
.collect(Collectors.joining(","));
System.out.println("exportSnByIBD param="+collect);

2、List<String>  去重

List<String> newshipNumbers = ibds.stream().distinct().collect(Collectors.toList());

页面上根据订单号导出,可以输入多个订单号,添加一个判断,就是去重。不然导出的数据有重复的

原文地址:https://www.cnblogs.com/lyon91/p/11357905.html