Skip to content

Commit

Permalink
More idiomatic solution
Browse files Browse the repository at this point in the history
  • Loading branch information
basdgrt committed Oct 21, 2023
1 parent 31b8947 commit ddaddea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package nl.freshminds
* Find the amount of races held in the 2023 season.
*/
fun amountOfRacesIn2023(races: List<Race>): Int {
return races.filter { it.season == 2023 }.size
return races.count { it.season == 2023 }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package nl.freshminds
* Return the number of results for a given status.
*/
fun countResultsByStatus(race: Race, status: String): Int {
return race.results.filter { it.status == status }.size
return race.results.count { it.status == status }
}

/**
Expand Down

0 comments on commit ddaddea

Please sign in to comment.