标签:style code sys map ini 最小 finish nbsp size
1.1 max,min,count 方法 最大/最小/计数
demo:
@Test public void maxTest(){ OptionalDouble optional = list.stream().mapToDouble(sku->sku.getTotalPrice()).max(); System.out.println(optional.getAsDouble()); }
打印日志:
5000.0
Process finished with exit code 0
demo:
@Test public void minTest(){ OptionalDouble optional = list.stream().mapToDouble(sku->sku.getTotalPrice()).min(); System.out.println(optional.getAsDouble()); }
打印日志:
20.0
Process finished with exit code 0
demo:
@Test public void countTest(){ long lNumber = list.stream().count(); System.out.println(lNumber); }
打印日志:
8
Process finished with exit code 0
高效 告别996,开启java高效编程之门 3-13实战:常用终端操作之最大/最小/计数
标签:style code sys map ini 最小 finish nbsp size
原文地址:https://www.cnblogs.com/1446358788-qq/p/12806492.html