removed unnecesary curly braces

This commit is contained in:
Sugui 2023-12-02 10:40:10 +01:00
parent 9515c5b18f
commit fc5804a157
1 changed files with 2 additions and 4 deletions

View File

@ -71,10 +71,8 @@ public class Day02 {
public static String getFirstPuzzleResult(String input) {
List<Game> games = parse(input);
int result = games.stream()
.filter(game -> {
return game.bunches.stream().allMatch(bunch -> bunch.red <= MAX_RED_CONTENTS
&& bunch.green <= MAX_GREEN_CONTENTS && bunch.blue <= MAX_BLUE_CONTENTS);
})
.filter(game -> game.bunches.stream().allMatch(bunch -> bunch.red <= MAX_RED_CONTENTS
&& bunch.green <= MAX_GREEN_CONTENTS && bunch.blue <= MAX_BLUE_CONTENTS))
.map(game -> game.id)
.reduce(0, (a, b) -> a + b);
return Integer.toString(result);