public List<CourseDTO> translateAllCoursestoDataTransferObject(List<CourseBO> coursesToAttend) { if (CollectionUtils.isEmpty(coursesToAttend)) { return Collections.emptyList(); } else { List<CourseDTO> coursesToAttendDTO = new ArrayList<CourseDTO>(); for (CourseBO courseBO : coursesToAttend) { coursesToAttendDTO.add( new CourseDTO(courseBO.getCourseId(), courseBO.getName(), courseBO.getNoOfStudents())); } return coursesToAttendDTO; } }
public CourseDTO translateCourseToDataTransferObject(CourseBO courseBO) { return new CourseDTO(courseBO.getCourseId(), courseBO.getName(), courseBO.getNoOfStudents()); }