可以使用Java 8的流操作来解决这个问题。

List<OdsMaterialbomItem> items = splitIsB.stream()
        .flatMap(splitItem -> bomItems.stream()
                .filter(bomItem -> bomItem.getBillOfMaterialComponent().equals(splitItem.getProductId())))
        .collect(Collectors.toList());

这里使用了stream()方法将splitIsB转换为一个流,然后使用flatMap()方法将每个splitItem映射为一个bomItems流,并使用filter()方法过滤出BillOfMaterialComponentproductId相同的行。最后使用collect()方法将结果收集到一个新的List中。

这种方式的运行效率较高,因为它使用了并行流操作,可以充分利用多核处理器的性能

java 已知对象ListSplitProductionOrderItem splitIsBListOdsMaterialbomItem bomItems根据SplitProductionOrderItem中的字段productId值与bomItems的OdsMaterialbomItem中字段BillOfMaterialComponent相同的行生成新的ListOdsMaterialbomIte

原文地址: http://www.cveoy.top/t/topic/iTgt 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录