What is the output of the following Java program?
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
Map<Character, List<String>> groups = new TreeMap<>();
for (String n : List.of("Ravi", "Asha", "Rohit", "Meena", "Arjun", "Riya")) {
groups.computeIfAbsent(n.charAt(0), k -> new ArrayList<>()).add(n);
}
System.out.println(groups + " " + groups.get('R').size());
}
}
Keys are sorted; each list keeps names in the order they were added.