java 8 list to map with occurrences code example
Example: java 8 list to map with occurrences
Map<String, Long> cardsMap = cards
.stream()
.collect(Collectors.groupingBy(Card::getCardValue, Collectors.counting()));
Map<String, Long> cardsMap = cards
.stream()
.collect(Collectors.groupingBy(Card::getCardValue, Collectors.counting()));