@Test public void countsByRank() { Assert.assertEquals(Long.valueOf(4), this.jdkDeck.countsByRank().get(Rank.TEN)); }
public Map<Rank, Long> countsByRank() { Map<Rank, Long> result = new HashMap<>(); for (Card card : this.cards) { Rank rank = card.rank(); Long value = result.get(rank); if (value == null) { value = Long.valueOf(0); } result.put(rank, value + 1); } return result; }
JDKImperativeDeckOfCardsAsSortedSet { public Map<Rank, Long> countsByRank() { Map<Rank, Long> result = new HashMap<>(); for (Card card : this.cards) { Rank rank = card.rank(); Long value = result.get(rank); if (value == null) { value = Long.valueOf(0); } result.put(rank, value + 1); } return result; } }
JDKImperativeDeckOfCardsAsSortedSet { public Map<Rank, Long> countsByRank() { Map<Rank, Long> result = new HashMap<>(); for (Card card : this.cards) { Rank rank = card.rank(); Long value = result.get(rank); if (value == null) { value = Long.valueOf(0); } result.put(rank, value + 1); } return result; } JDKImperativeDeckOfCardsAsSortedSet(); }
JDKImperativeDeckOfCardsAsSortedSet { public Map<Rank, Long> countsByRank() { Map<Rank, Long> result = new HashMap<>(); for (Card card : this.cards) { Rank rank = card.rank(); Long value = result.get(rank); if (value == null) { value = Long.valueOf(0); } result.put(rank, value + 1); } return result; } 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 Map<Rank, Long> countsByRank() { Map<Rank, Long> result = new HashMap<>(); for (Card card : this.cards) { Rank rank = card.rank(); Long value = result.get(rank); if (value == null) { value = Long.valueOf(0); } result.put(rank, value + 1); } return result; } 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();  }