2020-10-09 14:53:54 +02:00
|
|
|
package com.plannaplan.responses.mappers;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import com.plannaplan.entities.Course;
|
2020-11-08 17:20:00 +01:00
|
|
|
import com.plannaplan.responses.models.CoursesDefaultResponse;
|
|
|
|
import com.plannaplan.responses.models.CoursesWithGroupsResponse;
|
2020-10-09 14:53:54 +02:00
|
|
|
|
|
|
|
public class CoursesResponseMappers {
|
2020-11-08 17:20:00 +01:00
|
|
|
public static final List<CoursesDefaultResponse> mapToGetCoursesResponse(List<Course> courses) {
|
|
|
|
return courses.stream().filter(Objects::nonNull).map(CoursesDefaultResponse::new).collect(Collectors.toList());
|
2020-10-09 14:53:54 +02:00
|
|
|
}
|
2020-10-13 17:07:04 +02:00
|
|
|
|
2020-11-08 17:20:00 +01:00
|
|
|
public static final List<CoursesWithGroupsResponse> mapToGetCoursesWithGroupsResponse(List<Course> courses) {
|
|
|
|
return courses.stream().filter(Objects::nonNull).map(CoursesWithGroupsResponse::new)
|
2020-10-13 17:07:04 +02:00
|
|
|
.collect(Collectors.toList());
|
|
|
|
}
|
2020-10-09 14:53:54 +02:00
|
|
|
}
|