-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathDeck.java
More file actions
29 lines (23 loc) · 790 Bytes
/
Deck.java
File metadata and controls
29 lines (23 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package blackjack;
import java.util.Arrays;
import java.util.Collections;
public class Deck {
private static Cards pool = new Cards();
private static final int MINIMUM_NUMBER = 1;
private static final int MAXIMUM_NUMBER = 10;
static {
Arrays.stream(CardNumber.values()).forEach(number -> {
pool.push(new Card(number, CardSuit.DIAMOND));
pool.push(new Card(number, CardSuit.CLOVER));
pool.push(new Card(number, CardSuit.HEART));
pool.push(new Card(number, CardSuit.SPADE));
});
// Collections.shuffle(pool.getCards());
}
public Card getOneCard(Integer index) {
return new Card(pool.getCards().get(index));
}
public Integer getSize() {
return pool.getSize();
}
}