Remove redundant Card record code

Java Records automatically acquire an implementation of equals and
hashCode that accounts for their components. They also have read
accessors for their components (card.suit() to get the suit).
This commit is contained in:
Dave Burke
2022-03-18 17:01:06 -05:00
parent 0b1f809707
commit cdf194f770
5 changed files with 8 additions and 40 deletions

View File

@@ -13,11 +13,11 @@ public class DeckTest {
// Then
long nCards = deck.size();
long nSuits = deck.getCards().stream()
.map(card -> card.getSuit())
.map(card -> card.suit())
.distinct()
.count();
long nValues = deck.getCards().stream()
.map(card -> card.getValue())
.map(card -> card.value())
.distinct()
.count();