-
Notifications
You must be signed in to change notification settings - Fork 389
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
1203 #8
base: main
Are you sure you want to change the base?
1203 #8
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.
고생하셨습니다!!
만약 아직 테스트 통과 안된거면 반복문 흐름 제어에서 살짝 문제가 생긴 것 같은데 한번 확인해주시면 좋을 것 같아요!!@@
for(String name : category) { | ||
} | ||
for (String categoryItem : category) { | ||
if (Collections.frequency(category, categoryItem) >= 3) { |
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.
우왕 이런 기능도 있군요 유용하네요 배워갑니다
} | ||
|
||
} | ||
break; |
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.
이렇게 되면 랜덤뽑기한 카테고리가 요구사항에 맞지 않으면 (= !checkRepeat면) 카테고리를 다시 뽑는 게 아니라 그냥 메서드가 끝나버리는 것 같은데 맞나유?
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.
먼가 continue가 맞을 것 같은데.. 확실하진 않네요 한번 확인 부탁드립니당
return menu; | ||
} | ||
} | ||
return null; |
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.
만약 개발 중에 실수로 메뉴명이 잘못 들어가면 에러 대신 null이 반환되고, nullpointer 문제가 생기기 때문에 이상황에선 대신에 명확한 에러사유와 함께 에러를 날려줘도 좋을 것 같아요!
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.
오 그렇군요
반복문 흐름 제어까지 꼼꼼하게 봐주셔서 감사합니다
eatFoods.add(menu); | ||
} | ||
|
||
return new Person(name, eatFoods.toArray(new String[0])); |
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.
기존에 있던 People객체에 정보를 추가하기보단 새로운 People 객체를 만드신 것 같은데 이유가 뭔가욤?
지금 Person의 필드가 cantFood인데 여기에 추천받은 메뉴를 저장하는 건 잘못된 저장 아닐까 싶어서요!
저라면 setter를 사용해서 추천메뉴 정보를 추가하거나, 아예 다른 객체를 만들어서 정보를 저장할 것 같은데 혹시 어떻게 생각하시나용
// people에서 싫어하는 음식 꺼내서 ForAnswer와 대조하기 | ||
// 선택한 음식 5개 중에서 싫어하는 음식 확인 | ||
for (int i = 0; i < people.getPeople().size(); i++) { | ||
return checkFood(peopleForAnswer.getPeople().get(i), people.getPeople().get(i)); |
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.
제가 이해하기론 이렇게 되면 int i = 0일때 checkFood를 연산하고 메서드가 끝나버리지 않나요??
return문을 넣어버리니까 i=0일때 return되고 i=1로 넘어가지 않을 것 같은데... 괜찮던가유?
if (eatFoods.contains(s)) { | ||
return false; | ||
} | ||
eatFoods.add(s); |
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.
중복 확인 용이라면
if (new Hashset<>(List.of(person.getCantFoods())) != person.getCantFoods().length) {
return false;
}
와 같은 방법도 간단할 것 같습니다!
No description provided.