public interface Deck<T>
Any card stored in the deck is assumed to be immutable. If it's not, the integrity of the deck cannot be guaranteed.
Modifier and Type | Method and Description |
---|---|
void |
draw(Deck<T> other)
Draws one card from the top of another deck
|
void |
draw(Deck<T> other,
int n)
Draws n cards from the top of another deck
|
void |
emptyInto(Deck<T> other)
Moves all cards in this deck into another deck
|
java.util.List<T> |
getCards()
Gets a list of all cards in this deck
The list should have the correct order according to the actual order within the deck.
|
boolean |
isEmpty()
Whether this deck is empty
|
T |
peekBottom()
Takes a peek at the card currently at the bottom of the deck
|
T |
peekTop()
Takes a peek at the card currently at the top of the deck
|
void |
shuffle()
Shuffles the order of the cards in the deck
|
int |
size()
Gets the number of cards currently in this deck
|
void shuffle()
void draw(Deck<T> other)
other
- The deck to draw the card fromvoid draw(Deck<T> other, int n)
other
- The other deck to draw fromn
- The number of cards to drawvoid emptyInto(Deck<T> other)
other
- The deck to move this deck's cards intoboolean isEmpty()
int size()
T peekTop()
T peekBottom()
java.util.List<T> getCards()
The list should have the correct order according to the actual order within the deck.