当前位置:网站首页>Lambda终结操作max&min
Lambda终结操作max&min
2022-06-13 03:35:00 【Leon_Jinhai_Sun】
max&min
可以用来或者流中的最值。
例子:
分别获取这些作家的所出书籍的最高分和最低分并打印。
// 分别获取这些作家的所出书籍的最高分和最低分并打印。
//Stream<Author> -> Stream<Book> ->Stream<Integer> ->求值
List<Author> authors = getAuthors();
Optional<Integer> max = authors.stream()
.flatMap(author -> author.getBooks().stream())
.map(book -> book.getScore())
.max((score1, score2) -> score1 - score2);
Optional<Integer> min = authors.stream()
.flatMap(author -> author.getBooks().stream())
.map(book -> book.getScore())
.min((score1, score2) -> score1 - score2);
System.out.println(max.get());
System.out.println(min.get());边栏推荐
- Azure SQL db/dw series (14) -- using query store (3) -- common scenarios
- Simulink code generation: simple state machine and its code
- [test development] automated test selenium (III) -- unittest framework analysis
- [azure data platform] ETL tool (1) -- Introduction to azure data factory
- Masa auth - SSO and identity design
- MySQL learning summary 8: addition, deletion and modification of data processing
- Display line number in MySQL query result
- [azure data platform] ETL tool (5) -- use azure data factory data stream to convert data
- 【测试开发】博客系统——Loadrunner性能测试(发布博客功能 基准测试)
- Peking University HP financial index - matching enterprise green innovation index 2011-2020: enterprise name, year, industry classification and other multi indicator data
猜你喜欢

Understand the difference between reducebykey and groupbykey in spark

Alibaba cloud keep on record

LVS四层负载均衡集群(6)LVS工作模式

【测试开发】软件测试基础篇

Onnx+tensorrt+yolov5: yolov5 deployment based on trt+onnx 1

Environmental pollution, enterprises, highways, fixed assets, foreign investment in all prefecture level cities in China - latest panel data

look on? What is the case between neo4j and ongdb?

【测试开发】自动化测试selenium(二)——webdriver常用的API
![[test development] blog system - LoadRunner performance test (publish blog function benchmark test)](/img/d2/a37257fd7cca1d0a4e748c734a6ffc.png)
[test development] blog system - LoadRunner performance test (publish blog function benchmark test)

YoloV5-Face+TensorRT:基于WIN10+TensorRT8.2+VS2019得部署
随机推荐
【测试开发】自动化测试selenium(二)——webdriver常用的API
C语言程序设计——从键盘任意输入一个字符串(可以包含:字母、数字、标点符号,以及空格字符),计算其实际字符个数并打印输出,即不使用字符串处理函数strlen()编程,但能实现strlen()的功能。
YoloV5-Face+TensorRT:基于WIN10+TensorRT8.2+VS2019得部署
Configuration and practice of shardingsphere JDBC sub database separation of read and write
Doris data import broker load
Simulink code generation: simple state machine and its code
LVS four layer load balancing cluster (5) LVS overview
Azure SQL db/dw series (10) -- re understanding the query store (3) -- configuring the query store
Advanced API review
【测试开发】用例篇
Peking University HP financial index - matching enterprise green innovation index 2011-2020: enterprise name, year, industry classification and other multi indicator data
Data from the first to seventh census (to counties)
An error is reported in the JDBC connection database: connection to 139.9.130.37:15400 referred
CXGRID keeps the original display position after refreshing the data
[interview review] update from time to time for personal use
【多线程】多线程到底是个甚——多线程初阶(复习自用)
Solve the error in CONDA installation PyMOL
Spark optimization - data skew solution
Pollution discharge fees of listed companies 2010-2020 & environmental disclosure level of heavy pollution industry - original data and calculation results
Two Chinese vector map data with map review number