Source:
private Map<String, List<FeedbackResponseCommentAttributes>> getResponseComments( String feedbackSessionName, String courseId, String userEmail, UserRole role, CourseRoster roster, Map<String, FeedbackQuestionAttributes> relevantQuestions, String section, StudentAttributes student, Set<String> studentsEmailInTeam, Map<String, FeedbackResponseAttributes> relevantResponse) { Map<String, List<FeedbackResponseCommentAttributes>> responseComments = new HashMap<>(); List<FeedbackResponseCommentAttributes> allResponseComments = frcLogic.getFeedbackResponseCommentForSessionInSection(courseId, feedbackSessionName, section); for (FeedbackResponseCommentAttributes frc : allResponseComments) { FeedbackResponseAttributes relatedResponse = relevantResponse.get(frc.feedbackResponseId); FeedbackQuestionAttributes relatedQuestion = relevantQuestions.get(frc.feedbackQuestionId); boolean isVisibleResponseComment = frcLogic.isResponseCommentVisibleForUser( userEmail, role, student, studentsEmailInTeam, relatedResponse, relatedQuestion, frc); if (isVisibleResponseComment) { if (!frcLogic.isNameVisibleToUser(frc, relatedResponse, userEmail, roster)) { frc.giverEmail = "Anonymous"; } List<FeedbackResponseCommentAttributes> frcList = responseComments.get(frc.feedbackResponseId); if (frcList == null) { frcList = new ArrayList<>(); frcList.add(frc); responseComments.put(frc.feedbackResponseId, frcList); } else { frcList.add(frc); } } } for (List<FeedbackResponseCommentAttributes> responseCommentList : responseComments.values()) { sortByCreatedDate(responseCommentList); } return responseComments; }

Target:
private Map<String, List<FeedbackResponseCommentAttributes>> getResponseComments( String feedbackSessionName, String courseId, String userEmail, UserRole role, CourseRoster roster, Map<String, FeedbackQuestionAttributes> relevantQuestions, String section, StudentAttributes student, Set<String> studentsEmailInTeam, Map<String, FeedbackResponseAttributes> relevantResponse) { Map<String, List<FeedbackResponseCommentAttributes>> responseComments = new HashMap<>(); List<FeedbackResponseCommentAttributes> allResponseComments = frcLogic.getFeedbackResponseCommentForSessionInSection(courseId, feedbackSessionName, section); for (FeedbackResponseCommentAttributes frc : allResponseComments) { FeedbackResponseAttributes relatedResponse = relevantResponse.get(frc.feedbackResponseId); FeedbackQuestionAttributes relatedQuestion = relevantQuestions.get(frc.feedbackQuestionId); boolean isVisibleResponseComment = frcLogic.isResponseCommentVisibleForUser( userEmail, role, student, studentsEmailInTeam, relatedResponse, relatedQuestion, frc); if (isVisibleResponseComment) { if (!frcLogic.isNameVisibleToUser(frc, relatedResponse, userEmail, roster)) { frc.giverEmail = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT; } List<FeedbackResponseCommentAttributes> frcList = responseComments.get(frc.feedbackResponseId); if (frcList == null) { frcList = new ArrayList<>(); frcList.add(frc); responseComments.put(frc.feedbackResponseId, frcList); } else { frcList.add(frc); } } } for (List<FeedbackResponseCommentAttributes> responseCommentList : responseComments.values()) { sortByCreatedDate(responseCommentList); } return responseComments; }