[Team2 Pair1] 로또 Step1 완료#13
Open
westbro-zo wants to merge 1 commit into
Open
Conversation
javajigi
requested changes
Jul 5, 2018
| map.put(5, 0); | ||
| map.put(6, 0); | ||
| return map; | ||
| } |
Contributor
There was a problem hiding this comment.
클래스의 구현 순서는 다음과 같다. 다음 원칙에 따라 구현한다.
class A {
상수(static final) 또는 클래스 변수
인스턴스 변수
생성자
메소드
}
| return winningList(getIntegers(s)); | ||
| } | ||
|
|
||
| private Map<Integer, Integer> winningList(List<Integer> list) { |
Contributor
There was a problem hiding this comment.
List<Integer> list도 로또로 볼 수 있지 않을까?
| } | ||
|
|
||
| public static List<Integer> createNumber() { | ||
| List<Integer> lotto = IntStream.rangeClosed(1, 45).boxed().collect(Collectors.toList()); |
Contributor
There was a problem hiding this comment.
Lotto를 생성할 때마다 매번 45개의 값을 생성할 필요가 있을까?
45개의 값 하나를 생성해 놓고 재사용할 수 없을까?
| package lotto; | ||
|
|
||
| public enum WinPrize { | ||
| _3(5000), _4(50000), _5(1500000), _6(2000000000); |
Contributor
There was a problem hiding this comment.
enum은 "_"를 사용하기 보다 대문자로 사용하는 것이 일반적임
FIRST와 같이 등수를 사용하면 어떨까?
There was a problem hiding this comment.
처음에 저희도 일반적으로 values()로 Loop을 도는것을 생각을 했는데요.
별도의 Loop을 돌지 않는 간결한 코드, O(N) -> O(1)로 Time Complexity를 줄인다는 목적(사실 속도면에서 의미 있을까 싶지만)으로 이렇게 설계를 진행 했습니다만, 다시보니 valueOf에서 String을 새롭게 만드는 작업이 더 오래걸릴꺼 같군요 ㅠ.ㅠ
| return winnerNumbers.stream() | ||
| .filter(t -> numbers.contains(t)) | ||
| .collect(Collectors.toList()) | ||
| .size(); |
Contributor
There was a problem hiding this comment.
.collect(Collectors.toList()) 사용하지 말고 filter().count() 가능하지 않나?
| public static final int LOTTO_PRICE = 1000; | ||
|
|
||
| private final List<Lotto> lottos; | ||
| private final Map<Integer, Integer> map; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
불끄고 퇴근합니다 😂