Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[둘리] 2단계 자동차 경주 제출합니다. #68

Merged
merged 12 commits into from
Feb 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(CarsHelper): listOf() -> emptyList()로 변경
  • Loading branch information
hyemdooly committed Feb 13, 2023
commit 1b39386fdd83229a1c75b92d88a8d58867f9c213
2 changes: 1 addition & 1 deletion src/main/kotlin/util/CarsHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import model.Cars
object CarsHelper {

Choose a reason for hiding this comment

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

객체 이름만 봤을 때는 "자동차들의 도우미"로 해석이 되는데요.
여기서 Helper라는 단어는 포괄적인 의미로 사용돼요.
클래스에 정의된 함수의 역할에 맞게 클래스명을 작성해보면 어떨까요?

fun findWinners(cars: Cars): List<String> {
val equalCars = cars.cars.groupBy({ it.position }, { it.name })
return equalCars[equalCars.keys.max()]?.toList() ?: listOf()
return equalCars[equalCars.keys.max()]?.toList() ?: emptyList()
}
}