- Spring 5.0 By Example
- Claudio Eduardo de Oliveira
- 70字
- 2021-06-24 19:17:36
Keeping the news safely
Also, we need to check if the news is fully revised by all mandatory reviewers. It is quite simple, we are using Java 8, and it provides the amazing Stream interface, which makes the collections interactions easier than before. Let's do this:
public Boolean revised() {
return this.mandatoryReviewers.stream().allMatch(reviewer -> this.reviewers.stream()
.anyMatch(review -> reviewer.id.equals(review.userId) && "approved".equals(review.status)));
}
Thanks, Java 8, we appreciate it.
推薦閱讀
- C語言程序設計案例教程
- Learning NServiceBus(Second Edition)
- 精通Nginx(第2版)
- Python自然語言處理實戰(zhàn):核心技術與算法
- Instant Zepto.js
- 64位匯編語言的編程藝術
- Lua程序設計(第4版)
- Hands-On RESTful Web Services with Go
- QGIS:Becoming a GIS Power User
- Java應用開發(fā)技術實例教程
- Visual Basic程序設計習題與上機實踐
- Essential C++(中文版)
- 實戰(zhàn)Java高并發(fā)程序設計(第2版)
- C++ Application Development with Code:Blocks
- C++從入門到精通(第6版)