-
Notifications
You must be signed in to change notification settings - Fork 0
[자동차 경주] 이예진 미션 제출합니다. #3
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
base: main
Are you sure you want to change the base?
Conversation
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.
2주차 고생많으셨습니다! 이번에도 궁금한 것 위주로 질문 했습니다..ㅎㅎ.. 코드에 많은 도움이 되어드리지 못해 죄송합니다😂 저희 3주차도 파이팅해요~~!
| @@ -0,0 +1,3 @@ | |||
| package racingcar.model.car; | |||
|
|
|||
| public record CarStatus(String name, int position) { } | |||
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 void validateDuplicateNames(List<Car> cars) { | ||
| Set<String> uniqueNames = cars.stream() | ||
| .map(Car::name) | ||
| .collect(Collectors.toSet()); |
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.
stream에 대해서 찾아보다가 .toList()가 .collect(Collectors.toList())를 간결한 형태로 사용했다는 걸 봤는데요! 이것도 .toSet()으로 간결하게 작성이 가능한가요?
|
|
||
| public int maxPosition() { | ||
| return cars.stream() | ||
| .mapToInt(Car::position) |
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.
.map이랑 .mapToInt의 차이점이 뭔가요?
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.
저도 3주차 과제는 상수화해서 사용해보려고 합니다 많이 보고 배워요 감사합니다!
|
|
||
| private final Cars cars; | ||
| private final RoundLimit roundLimit; | ||
| private final List<List<CarStatus>> roundSnapshots = new ArrayList<>(); |
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.
이건 List 안에 List를 넣는 건가요?
| this.roundLimit = roundLimit; | ||
| } | ||
|
|
||
| public static RacingGame of(Cars cars, RoundLimit roundLimit) { |
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.
저번 주차 코드에서는 List.of에 대해서 물어보면서 불변 리스트 만들 때 사용한다고 알려주셨는데요 여기서 사용하는 of는 어떨 때 사용하나요? 무슨 의미인가요?
| @FunctionalInterface | ||
| public interface ValueGenerator { | ||
| int getValue(); | ||
| } |
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.