P
psmith
I have to merge two hashmaps, one results (contains grades), the other
students(contains students, with exam results. Their exam marks are
averaged out and graded. I need the students to appear in the results
hashmap against their grade, can somebody please point out what is
wrong with the following:
public void collateResults()
{
char grades[] = {'A', 'B', 'C', 'D', 'F', 'X'};
{
for (Character grade : grades)
{
this.results.put(grade, new HashSet<String>());
}
for (String eachStudent : students.keySet())
{
for(String graded : this.results.get(eachStudent))
{
this.results.get(graded).add(eachStudent);
}
}
}
}
Any help greatly appreciated.
Paul
students(contains students, with exam results. Their exam marks are
averaged out and graded. I need the students to appear in the results
hashmap against their grade, can somebody please point out what is
wrong with the following:
public void collateResults()
{
char grades[] = {'A', 'B', 'C', 'D', 'F', 'X'};
{
for (Character grade : grades)
{
this.results.put(grade, new HashSet<String>());
}
for (String eachStudent : students.keySet())
{
for(String graded : this.results.get(eachStudent))
{
this.results.get(graded).add(eachStudent);
}
}
}
}
Any help greatly appreciated.
Paul