我有一个名为Student
的类,它有一个String属性date
。我有所有学生的列表,现在我想创建多个按date
分组的ArrayLists
。
我想使用哈希图:
ArrayList students = getStudents();
Map map<String, ArrayList<Student>> = new HashMap<String, ArrayList<Student>);
for (Student i: students) {
// There must be something
}
我该如何创建多个学生ArrayList,这些ArrayList根据其属性的字符串值进行分组?