stream流

2022-03-17  本文已影响0人  __简单点__

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()

上一篇 下一篇

猜你喜欢

热点阅读