i have a List with Strings and group the same Strings.
List<String> allTypes = new ArrayList<String>();
Map<String, Long> count = allTypes.stream()
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
and then i get the count of the most frequent String
Long max = Collections.max(count.values());
Now i dont want only the count of the most frequent String i want the associated String too. The List is randomly filled with Strings from a other List.