I have this code:
List<String> list = Arrays.asList("a", "b", "c", "a", "c");
Map<String, List<String>> map = list.stream().collect(Collectors.groupingBy(
Function.identity() ,
Collectors.toCollection(ArrayList::new)
));
what it produces is
{a=[a, a], b=[b], c=[c, c]}
Pretty please how should I write mapping method to get a Map that would give me:
{a=2, b=1, c=2}