I have a List<String>
which is like,
List<String> dummyList=Arrays.asList("a","b","c","a","b","e","f","e");
I have a list which contains names of students in a class, I need a lambda expression to fetch only the count of students with names "a","b","c".
I tried using,
dummyList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
it gave count of entire students in the class, but I need the count of students "a","b","c", the final map should be of,
a:2
b:2
c:1