Skip to content
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

[자동차 경주] 리팩토링 #2390

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Suxxxxhyun
Copy link

No description provided.

Copy link

@shimbaa shimbaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

클래스 분리 정말 잘하셨네요 많이 배웠습니다😊
테스트도 mock 과 provider를 활용하셔서 꼼꼼하게 작성하신것 보고 많이 배웠습니다👍

} catch (GlobalException | IllegalArgumentException e) {
OutputView.printMessage(e.getMessage());
return getUserInput(inputReader);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수현님 혹시 우테코에서 제공하는 Console 라이브러리 사용안하신 이유가 있으신가요?
JDK에서 제공하는 Random 및 Scanner API 대신 camp.nextstep.edu.missionutils에서 제공하는 Randoms 및 Console API를 사용하여 구현해야 한다.
요구사항에 이게 있어서 여쭤봅니다!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엌ㅋㅋㅋ 놓쳤어요! ㅎㅎ..


return cars.stream()
.map(car -> CarStatusDto.create(car.getName(), car.getPosition()))
.collect(Collectors.toUnmodifiableList());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수현님 이 부분 찾아보니까
.collect(Collectors.toUnmodifiableList());

.toList();
로 바꾸셔도 동일한 코드 인 것 같아요!

default List<T> toList() {
        return (List<T>) Collections.unmodifiableList(new ArrayList<>(Arrays.asList(this.toArray())));
    }

위는 toList() 의 내부 코드인데 unmodifiableList 를 반환하고 있더군요!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좀 더 정확히 찾아보려고 chatGPT한테 물어본 결과 입니다!
결론은 저희 우테코 미션에서 자바 17을 사용하니 toList()를 사용해도 되는군요☺️

https://chat.openai.com/share/100db86c-6fc9-4bc6-a590-35de69c0aa02

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오옹!! 좋은 정보 감사해요!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants