-
Notifications
You must be signed in to change notification settings - Fork 7
4회차 과제 PR #32
base: chjih
Are you sure you want to change the base?
4회차 과제 PR #32
Conversation
refactor code
5글자 제한 추가
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전체적으로 코드가 간결해지고, 알기 쉬워졌습니다.
몇가지 코멘트 남겼으니 추가적으로 고민해보시고 개선해보시면 좋겠습니다.
private String checkLength(String name){ | ||
if(name.length()>5){ | ||
throw new IllegalArgumentException("자동차 이름은 5자를 넘을 수 없습니다."); | ||
} | ||
return name; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
자동차 이름에 대한 제약사항은 Cars 객체가 가지고 있는게 맞을까요? 아니면 Car 객체가 가지고 있는게 맞을까요?
Set<String> keys = record.getKeys(); | ||
int max = getMax(record); | ||
keys.stream() | ||
.filter(key -> record.getValue(key) == max) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
record 에서 값을 가져와서 비교하지 말고,
max 를 인자로 하여 질의하는 메소드를 record 객체에 만들어 보면 어떨까요?
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class Winner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Winner 객체 좋습니다 👍
private static final int MAX_BOUND = 9; | ||
private static final int MOVABLE_MIN = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다 👍
No description provided.