Skip to content

Conversation

@simpledumpling
Copy link
Owner

// (если в альбоме нет ни одного трека, считать, что максимум рейтинга в нем --- 0)
public static Optional<Album> minMaxRating(Stream<Album> albums) {
return albums.min(Comparator.comparing(album -> album.getTracks().stream()
.map(Track::getRating).max(Comparator.<Integer>naturalOrder()).orElse(0)));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapToInt(...).max()

@sproshev
Copy link

Зачтено, 10/10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants