-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
π 4λ¨κ³ - λ‘λ(μλ) #3550
base: gkssk4163
Are you sure you want to change the base?
Conversation
- λ©μμ§ λ³΄λ΄λ λ°©μμΌλ‘ λ³κ²½ - μμΈλ©μΈμ§ μΆκ°
- λ©μλ λ νΌλ°μ€ μ μ© - unmodifiableSet μ μ© - λΆνμν ν¨μ νΈμΆ μ κ±°
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.
4λ¨κ³ μ ꡬνν΄μ£Όμ
¨λ€μ π
λͺκ°μ§ κ³ λ―Όν΄λ³Όμ¬ν λ¨κ²¨λμλλ°
νμΈνμ λ€μ 리뷰μμ² λΆνλλ €μ!
@@ -13,10 +13,10 @@ public WinningLotto(Lotto winningLotto, LottoNumber bonus) { | |||
|
|||
private void validate() { |
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.
numbers()
λ₯Ό κΊΌλ΄μμ μνλ₯Ό νκ³ μμ§λ§ μ€μ winningLottoNumber λ
μ¬μ©νκ³ μμ§ μμ΅λλ€.
νλ¨κ³Ό κ°μ΄ μ²λ¦¬ν΄λ³Όμ μμ§ μμκΉμ?
if (winningLotto.hasNumber(this.bonus)) {
// μμΈ λ°μ
}
this.numbers = new TreeSet<>(parseLottoNumber(numbers)); | ||
validate(); | ||
} | ||
|
||
public Lotto(Integer... numbers) { | ||
this(Arrays.asList(numbers)); | ||
this(Set.copyOf(Arrays.asList(numbers))); |
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.
this(Set.copyOf(Arrays.asList(numbers))); | |
this(Set.of(numbers)); |
@@ -1,7 +1,7 @@ | |||
package lotto.domain; |
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.
LottoNumber μ λ³κ²½μ¬νμ΄ μμ΄ μ¬κΈ°μ λ¨κ²¨λμ΅λλ€.
LottoNumber μ κ²½μ° 1~45 μ μ«μμ΄κΈ° λλ¬Έμ λ§€λ² μΈμ€ν΄μ€λ₯Ό μμ±νμ§μκ³
μΊμ±μ²λ¦¬νμ¬ κ°μλ²νΈμ λν΄μ κ°μ μΈμ€ν΄μ€λ₯Ό μ¬μ©ν΄λ³Όμ μμκ² κ°μμ.
λ‘λ νΌλλ°± - αα
₯αΌαα
₯α¨ αα
’α¨αα
©α
α
΅ αα
¦αα
©αα
³, αα
΅α«αα
³αα
₯α«αα
³ αα
’αα
΅αΌ
μ μ°Έκ³ νμ¬ μ μ©ν΄λ³΄λ©΄ μ’μκ² κ°μ΅λλ€.
import java.util.stream.Collectors; | ||
import java.util.stream.IntStream; | ||
|
||
public class LottoBundle { | ||
|
||
private static final int LOTTO_PRICE = 1000; | ||
|
||
private final List<Lotto> lottoList; | ||
private final List<Lotto> manualLottoList; |
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.
LottoBundle μμ μλμΈμ§ μλμΈμ§ ꡬλΆμμ΄ νλμ 컬λ μ
μΌλ‘ κ΄λ¦¬ν΄λλμ§ μμκΉμ? π€
μ μ ν©ν 리 λ©μλλ₯Ό νμ©νμ¬ μμ±ν΄μΌνλ μλλ‘λ + μλμμ±λ λ‘λλ₯Ό λν΄μ λͺ©λ‘μ
λ§λ€λλ‘ ν΄λ³Όμλ μμκ² κ°μ΅λλ€.
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Scanner; | ||
import java.util.*; | ||
import java.util.stream.Collectors; | ||
|
||
public class InputView { |
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.
μꡬμ¬ν
μμΈ μ²λ¦¬λ₯Ό ν΅ν΄ μλ¬κ° λ°μνμ§ μλλ‘ νλ€.
ννΈ
- μ¬μ©μκ° μλͺ»λ κ°μ μ λ ₯νμ λ java exceptionμΌλ‘ μλ¬ μ²λ¦¬λ₯Ό νλ€.
μλ¨μ μꡬμ¬νμ λ§μΆ° μ
λ ₯λ¨κ³μμ μμΈκ° λ°μνμ§ μλλ‘
try catch ꡬ문μ νμ©νμ¬ μ¬μ
λ ₯μ λ°λλ‘ ν΄λ³΄λ©΄ μ’μκ² κ°μ΅λλ€.
Arguments.of(Arrays.asList(1, 2, 3, 4, 5, 7), LottoResult.BONUS), | ||
Arguments.of(Arrays.asList(1, 2, 3, 4, 5, 6), LottoResult.SIX), | ||
Arguments.of(Arrays.asList(6, 7, 8, 9, 10, 11), LottoResult.FAIL) | ||
Arguments.of(new Integer[]{1, 3, 5, 7, 9, 11}, LottoResult.THREE), |
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.
νλ¨κ³Ό κ°μ΄ μ£Όμμ±μλ₯Ό μ΄μ©νκ² ν΄λ³Όμλ μμκ² κ°μ΅λλ€!
Arguments.of(new Integer[]{1, 3, 5, 7, 9, 11}, LottoResult.THREE), | |
Arguments.of(Set.of(1, 3, 5, 7, 9, 11)}, LottoResult.THREE) |
3λ¨κ³ νΌλλ°± λ°μ λ° 4λ¨κ³ κΈ°λ₯ꡬν μλ£νμ¬ λ¦¬λ·°μμ²λ립λλ€~!