@Test public void deal() { Deque<Card> jdkShuffle = this.jdkDeck.shuffle(new Random(1)); Set<Card> 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) { Set<Card> hand = new HashSet<>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; }
JDKImperativeDeckOfCardsAsSortedSet { public Set<Card> deal(Deque<Card> deque, int count) { Set<Card> hand = new HashSet<>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } }
JDKImperativeDeckOfCardsAsSortedSet { public Set<Card> deal(Deque<Card> deque, int count) { Set<Card> hand = new HashSet<>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } JDKImperativeDeckOfCardsAsSortedSet(); }
JDKImperativeDeckOfCardsAsSortedSet { public Set<Card> deal(Deque<Card> deque, int count) { Set<Card> hand = new HashSet<>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } JDKImperativeDeckOfCardsAsSortedSet(); 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); SortedSet<Card> diamonds(); SortedSet<Card> hearts(); SortedSet<Card> spades(); SortedSet<Card> clubs(); Map<Suit, Long> countsBySuit(); Map<Rank, Long> countsByRank(); SortedSet<Card> getCards(); Map<Suit, SortedSet<Card>> getCardsBySuit(); }
JDKImperativeDeckOfCardsAsSortedSet { public Set<Card> deal(Deque<Card> deque, int count) { Set<Card> hand = new HashSet<>(); for (int i = 0; i < count; i++) { hand.add(deque.pop()); } return hand; } JDKImperativeDeckOfCardsAsSortedSet(); 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); SortedSet<Card> diamonds(); SortedSet<Card> hearts(); SortedSet<Card> spades(); SortedSet<Card> clubs(); Map<Suit, Long> countsBySuit(); Map<Rank, Long> countsByRank(); SortedSet<Card> getCards(); Map<Suit, SortedSet<Card>> getCardsBySuit();  }