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.

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.