LeadingExam leadingExam = new LeadingExam();
leadingExam.setFollowingExamList(new ArrayList<FollowingExam>(10));
leadingTopicToExamMap.put(topic, leadingExam);
exam = leadingExam;
} else {
FollowingExam followingExam = new FollowingExam();
LeadingExam leadingExam = leadingTopicToExamMap.get(leadingTopic);
if (leadingExam == null) {
throw new IllegalStateException("The followingExam (" + topic.getId()
+ ")'s leadingExam (" + leadingExam + ") cannot be null.");
}
followingExam.setLeadingExam(leadingExam);
leadingExam.getFollowingExamList().add(followingExam);
exam = followingExam;
}
exam.setId(topic.getId());
exam.setTopic(topic);