Conversation
bit.ly/3g4kkS5
shkisme
reviewed
Nov 18, 2022
Contributor
shkisme
left a comment
There was a problem hiding this comment.
리뷰가 조금 늦었습니다! 🙇♀️ stream 을 아주 잘 쓰시네요 ㅎㅎ
| private void printStatus() { | ||
| carList.forEach(car -> | ||
| System.out.printf("%s : %s\n", car.getName(), | ||
| PROGRESS_BAR.repeat(car.getPosition()))); |
Contributor
There was a problem hiding this comment.
👍👍👍 for 문으로 돌리는 것보다 훨씬 간결합니다
| public static final int RANDOM_MIN_NUMBER = 4; | ||
| public static final String SEPARATOR = ","; | ||
| public static final String PROGRESS_BAR = "-"; | ||
| public static final Scanner SCANNER = new Scanner(System.in); |
Contributor
There was a problem hiding this comment.
의미가 있는 상수, 자주쓰는 상수, Scanner 들을 Util 클래스로 분리하신 점 좋습니다!
|
|
||
| private void input() { | ||
| System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉼표(,) 기준으로 구분)"); | ||
| while (inputCarNames() == false) |
Contributor
There was a problem hiding this comment.
inputCarNames 메서드가 boolean 값을 반환하고 있는데, 어떤 의미인지 명확하진 않은 것 같습니다. Enum으로 표현하는 것은 어떨까요?
ex)
while (inputCarNames() == INVALID)
;| .collect(Collectors.joining(String.format("%s ", SEPARATOR)))); | ||
| } | ||
|
|
||
| public void run() { |
Contributor
There was a problem hiding this comment.
run 메서드를 클래스 가장 밑에 두신 이유가 있나요? 코드 가독성 면에서는 위에 두는 것도 괜찮을 것 같아서요!
| int maxPosition = carList.stream() | ||
| .map(Car::getPosition) | ||
| .reduce(Integer::max) | ||
| .orElse(-1); |
| private int count = 0; | ||
|
|
||
| private int randomize() { | ||
| Random r = new Random(); |
Contributor
There was a problem hiding this comment.
Random도 Util 클래스에 두거나, GamePlayer 필드에 두는 것은 어떤가요?
Author
|
@shkisme 수정 완료하였습니다 :) |
shkisme
approved these changes
Nov 19, 2022
Contributor
shkisme
left a comment
There was a problem hiding this comment.
수고하셨습니다! 다음 챌린지 로또게임 해보셔도 좋을 것 같네요 ㅎㅎ 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
이번 챌린지는 functional한 기능들을 사용하여 구현해봤습니다.
확실히 코드가 길어지지 않고 한 눈에 보이네요.
시간 날 때마다 업데이트 해보겠습니다.
테스트 코드도 작성해보겠습니다 ㅎㅎ..