Think Constructive

What is the output of below code snippet?

public class GroupingByDemoString {
public static void main(String args[])
{
List<String> listOfNames = new ArrayList<>(Arrays.asList("APJ Kalam", "Bill Gates",
"Steve Jobs", "APJ Kalam", "Bill Gates",
"Steve Jobs","APJ Kalam", "Bill Gates",
"Steve Jobs", "Steve Jobs" ));

Map<String, Long> countOfNames = listOfNames.stream().collect(
Collectors.groupingBy(Function.identity(), Collectors.counting())
);

countOfNames.forEach((keyOfNames, valueOfCount)-> System.out.println(
keyOfNames.toString() + " is = " + valueOfCount.toString()
));
}
}

#softwaredeveloper #softwareengineer #thinkconstructive #eshapuri #javadeveloperinterview #codinginterview #javainterviewquestion #code #coding #javacollections #javacollectors

1 month ago | [YT] | 18