mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-25 12:25:10 -08:00
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:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user