1.stream流: 求最大值 最小值:
dataList.stream().min(Comparator.comparing(StoreProductAttrValue::getPrice)).get().getPrice()
即: 数据集合.stream().min(Comparator.comparing(数据::get属性)).get() 得到对应的最小数据
attrValues.stream().max(Comparator.comparing(StoreProductAttrValue::getPrice)).get().getPrice()
网友评论