import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.stream.Collectors;
import java.util.stream.Stream;
List<OrderAppointmentSales> orderAppointmentSales = obcOrderAppointmentSalesService.getOrderAppointmentSalesList(syncTime);
List<OrderAppointmentSales> orderAppointmentSales2 = obcOrderAppointmentSalesService.getOrderAppointmentSalesListByTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS").format(sas.getUpdateTime()));
//将数据list对象合并去重 使用Stream来帮我们完成操作
List<OrderAppointmentSales> ords = Stream.of(orderAppointmentSales, orderAppointmentSales2)
.flatMap(Collection::stream)
.distinct()
.collect(Collectors.toList());
java 将两个List对象合并并去重
最新推荐文章于 2024-08-21 10:15:52 发布