我有一个学生集合 - Set<Student> students
class Student{
String Id;
String getId(){ return Id;}
.....
}
我正在尝试使用上述set中的条目初始化一个
Map<String,List<StudentResult>>
:Map<String,List<StudentResult>> studentResultMap = students.keySet().stream().collect(
Collectors.toMap(x -> x.getId(),new ArrayList<StudentResult>()));
但是这段代码无法编译 - 如何实现?