20221130 자동차경주게임#510
Open
SEUNGHEE96 wants to merge 26 commits intowoowacourse:mainfrom
Open
Conversation
2jun0
reviewed
Nov 30, 2022
2jun0
left a comment
There was a problem hiding this comment.
코드 잘 봤습니다!
mvc로 나눈 게 인상이 깊네요!
많이 배우고 갑니다!
|
|
||
| import java.util.List; | ||
|
|
||
| public class racingController { |
Author
There was a problem hiding this comment.
아! 알려주셔서 감사합니다! 컨벤션 참고해서 수정하도록 하겠습니다 @_@
| nameRange(names); | ||
| sameName(names); | ||
| } catch (IllegalArgumentException e) { | ||
| getNames(); |
There was a problem hiding this comment.
사용자가 1억번이나 실수하면 프로그램이 터질 것 같습니다!
while 문을 사용해보는건 어떨까요?
아래 예시가 도움이 됬으면 좋겠습니다.
public String[] getNames() {
repeatInputUntilSuccess(() -> {
// 여기에 코드 입력
});
}
private <T> T repeatInputUntilSuccess(Supplier<T> callback) {
while (true) {
try {
return callback.get();
} catch (IllegalArgumentException e) {
println("[ERROR] %s", e.getMessage());
}
}
}
Author
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.
20221130 자동차경주게임