List<String> collect = objects.stream().distinct().collect(Collectors.toList());
data = data.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()->newTreeSet<>(Comparator.comparing(x -> x.get("aoi_eq_no")+""))),ArrayList::new));
List字符串拼接
List<String> list =Arrays.asList("A","B","C","D");String result = list.stream().map(x ->"'"+ x +"'").collect(Collectors.joining(", ","(",")"));// 输出结果:('A', 'B', 'C', 'D')--------------------------------------------------------------------------------------------------List<String> list =newArrayList<>();String result= list.stream().map(x ->"'"+ x +"'").collect(Collectors.joining(", ","(",")"));// 输出结果:()
或者:
" and event_id in ('"+String.join("','", eventIdList)+"')";