public static Stream<String> getCardsByRank(List<String> cards, char rank) { return cards.stream() .distinct() .filter(s -> s.charAt(1) == rank) .sorted(); }
return cards.stream() .distinct() .filter(s -> s.charAt(0) == rank) // ^ .sorted();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)