-
Notifications
You must be signed in to change notification settings - Fork 0
[자동차 경주] 서희정 미션 제출합니다. #1
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주차도 파이팅해요 😃
| ## 💻 회고 | ||
| 지난 다른 분들의 코드를 보고 분리하여 | ||
| 한 클래스당 한 기능이 되도록 코드를 작성하였다. | ||
| 더 분리가 가능하다면 알고싶기에 다른 분들의 코드도 무척 기대가 된다. | ||
|
|
||
| 또한, 지난 시간에 Stream을 사용하셔서 코드를 작성하신 분이 계시다고 하셨는데 | ||
| 이때는 Stream이란 것을 몰라서 왜 쓰는 건지 싶었다. | ||
| 이번 2주차에 Stream에 대해 공부하게 되었고, 이를 2주차에 적용해보았다. |
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.
어떤 것을 적용하려고 했는지 알고 들어갈 수 있어서 회고 부분 좋은 것 같아요!
| public class Car { | ||
| private final String name; | ||
| private int position; | ||
|
|
||
| public Car(String name) { | ||
| this.name = name; | ||
| this.position = 0; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public int getPosition() { | ||
| return 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(Car::getPosition) | ||
| .max(Comparator.naturalOrder()) |
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에 max가 있었군요? 배워갑니다! Comparator.naturalOrder()는 어떤건가요?
No description provided.