I can create with enhanced for loop and with map's computeIfAbsent as below.
String [][] students = {{"David","50"},{"Sherif","70"},{"Bhavya","85"},{"Bhavya","95"}};
Map<String, List<Integer>> map = new HashMap<String, List<Integer>>();
for(String student[] : students) {
map.computeIfAbsent(student[0], (k)->new ArrayList<Integer>()).add(Integer.parseInt(student[1]));
}
Is there any way I can use stream with collectors api to build map as above?
Map<String, List<Integer>> m = Arrays.stream(students)
.collect(Collectors.?);