@Test public void deal() { var jdk1Shuffle = this.jdk1Deck.shuffle(new Random(1)); var jdk2Shuffle = this.jdk2Deck.shuffle(new Random(1)); var jdk1Hand = this.jdk1Deck.deal(jdk1Shuffle, 5); var jdk2Hand = this.jdk2Deck.deal(jdk2Shuffle, 5); Assert.assertEquals(jdk1Hand, jdk2Hand); }
public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); IntStream.range(0, count).forEach(i -> hand.add(deque.pop())); return hand; }
JDK8DeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); IntStream.range(0, count).forEach(i -> hand.add(deque.pop())); return hand; } }
JDK8DeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); IntStream.range(0, count).forEach(i -> hand.add(deque.pop())); return hand; } JDK8DeckOfCardsAsList(); }
JDK8DeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); IntStream.range(0, count).forEach(i -> hand.add(deque.pop())); return hand; } JDK8DeckOfCardsAsList(); 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(); }
JDK8DeckOfCardsAsList { public Set<Card> deal(Deque<Card> deque, int count) { var hand = new HashSet<Card>(); IntStream.range(0, count).forEach(i -> hand.add(deque.pop())); return hand; } JDK8DeckOfCardsAsList(); 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();  }