Java Stream - group by when key appears in a list
问题 I am trying to group by a collection by a value that appears in my object as a list. This is the model that I have public class Student { String stud_id; String stud_name; List<String> stud_location = new ArrayList<>(); public Student(String stud_id, String stud_name, String... stud_location) { this.stud_id = stud_id; this.stud_name = stud_name; this.stud_location.addAll(Arrays.asList(stud_location)); } } When I initialize it with the following : List<Student> studlist = new ArrayList<Student