ListHealthDevicePicResult healthDevicePicResults = healthDevicePicResultServicegetAllPicByBarcodebarcode; HealthDevicePicResult nowPicResult = healthDevicePicResultServicegetByBarcodebarcode;如何去除hea
你可以使用Java的Stream API来过滤掉healthDevicePicResults中与nowPicResult相同的数据。以下是一个可能的解决方案:
List<HealthDevicePicResult> filteredResults = healthDevicePicResults.stream()
.filter(result -> !result.equals(nowPicResult))
.collect(Collectors.toList());
这段代码使用stream()方法将healthDevicePicResults转换为流,然后使用filter()方法过滤掉与nowPicResult相同的数据。最后,使用collect()方法将过滤后的结果收集到一个新的列表中。请确保HealthDevicePicResult类正确地实现了equals()方法,以便正确比较对象的相等性。
原文地址: https://www.cveoy.top/t/topic/izBC 著作权归作者所有。请勿转载和采集!