Skip to content

Commit

Permalink
SAK-33868 Gradbook Classic GradeEvent returns null vs empty list (sak…
Browse files Browse the repository at this point in the history
  • Loading branch information
ern authored Jan 31, 2018
1 parent f31bc02 commit fd8fab2
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
* @author <a href="mailto:[email protected]">Josh Holtzman</a>
*/
public class GradingEvents implements Serializable {
protected Map<String, List<GradingEvent>> studentsToEventsMap;

public GradingEvents() {
studentsToEventsMap = new HashMap<>();
}
private Map<String, List<GradingEvent>> studentsToEventsMap = new HashMap<>();

/**
* Returns a list of grading events, which may be empty if none exist.
Expand All @@ -40,7 +36,11 @@ public GradingEvents() {
* @return
*/
public List<GradingEvent> getEvents(String studentId) {
return studentsToEventsMap.get(studentId);
List<GradingEvent> list = studentsToEventsMap.get(studentId);
if (list == null) {
list = new ArrayList<>();
}
return list;
}

public void addEvent(GradingEvent event) {
Expand Down

0 comments on commit fd8fab2

Please sign in to comment.