Counting the number of occurrences of words in a string array:
Map<String, Long> counted = Stream.of(arrayOfStrings)
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
Counting the number of occurrences of words in a string array:
Map<String, Long> counted = Stream.of(arrayOfStrings)
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));