Skip to content

Java02. ДЗ 02, Старкова Анастасия, подгруппа 2#2

Open
simpledumpling wants to merge 5 commits intomasterfrom
Task02.Streams
Open

Java02. ДЗ 02, Старкова Анастасия, подгруппа 2#2
simpledumpling wants to merge 5 commits intomasterfrom
Task02.Streams

Conversation

@simpledumpling
Copy link
Copy Markdown
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)));
Copy link
Copy Markdown

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
Copy Markdown

Зачтено, 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.

2 participants