常规做法就是遍历list,然后取出studentNo&name进行比对,放在map中,like this:
for( student in studentList){
if(map.contains(student[(name+studentNo)])){
map.get(name+studentNo)+student.score
}else{
// put score into the map with name&studentNo key
}
}
this map object is the final result you want
//或者你可以写一个子类继承hashmap,重写put方法,把这个方法包含了你需要的逻辑,然后一个个直接put进去即可