Created
May 19, 2022 21:17
-
-
Save mcs/986428e554c16e20fcd733d0b73b1aec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean test(List<Card> cards) { | |
if (cards == null || isStraightFlush.test(cards)) { | |
return false; | |
} | |
Map<Suit, Integer> sortedCards = cards.stream() | |
.map(Card::suit) | |
.collect(Collectors.toMap(Function.identity(), s -> 1, Integer::sum)); | |
return sortedCards.values().stream() | |
.anyMatch(count -> count >= 5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment