package com.plannaplan.responses.mappers; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import com.plannaplan.entities.Commision; import com.plannaplan.responses.models.CommisionResponse; import com.plannaplan.responses.models.CommisionWithGroupsResponse; /** * Mappers for Commisions to api responses */ public class CommisionResponseMappers { /** * @param commisions list of commisions to be mapped * @return list of api responses */ public static final List mapToResponse(List commisions) { return commisions.stream().filter(Objects::nonNull).map(CommisionResponse::new).collect(Collectors.toList()); } /** * @param commisions list of commisions to be mapped * @return list of api responses */ public static final List mapToResponseWithGroups(List commisions) { return commisions.stream().filter(Objects::nonNull).map(CommisionWithGroupsResponse::new) .collect(Collectors.toList()); } }