Java8新特性及用法(不定时更新)

时间:2023-01-31 11:45:59

从对象集合中过滤并拼接需要的串

String skus = productList.stream()
               .filter(product -> !StringUtil.isBlank(product.getGoodsCode()))
               .map(ScsTopProductStock::getGoodsCode)
               .collect(Collectors.joining(","));