@Test public void deal() { var jdkShuffle = this.jdkDeck.shuffle(new Random(1)); var jdkHand = this.jdkDeck.deal(jdkShuffle, 5); Assert.assertEquals(5, jdkHand.size()); Assert.assertEquals(47, jdkShuffle.size()); }
public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; }
JDKImperativeDeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } }
JDKImperativeDeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } JDKImperativeDeckOfCardsAsList(); }
JDKImperativeDeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } JDKImperativeDeckOfCardsAsList(); Deque<Card> shuffle(Random random); Set<Card> deal(Deque<Card> deque, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(Deque<Card> shuffled, int hands, int cardsPerHand); List<Card> diamonds(); List<Card> hearts(); List<Card> spades(); List<Card> clubs(); Map<Suit, Long> countsBySuit(); Map<Rank, Long> countsByRank(); List<Card> getCards(); Map<Suit, List<Card>> getCardsBySuit(); }
JDKImperativeDeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } JDKImperativeDeckOfCardsAsList(); Deque<Card> shuffle(Random random); Set<Card> deal(Deque<Card> deque, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(Deque<Card> shuffled, int hands, int cardsPerHand); List<Card> diamonds(); List<Card> hearts(); List<Card> spades(); List<Card> clubs(); Map<Suit, Long> countsBySuit(); Map<Rank, Long> countsByRank(); List<Card> getCards(); Map<Suit, List<Card>> getCardsBySuit();  }