2021-01-07 16:51:35 +01:00
|
|
|
package com.plannaplan.responses.mappers;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import com.plannaplan.entities.Exchange;
|
|
|
|
import com.plannaplan.responses.models.ExchangeResponse;
|
|
|
|
|
2021-01-15 17:53:13 +01:00
|
|
|
/**
|
|
|
|
* Mappers for Exchange to api responses
|
|
|
|
*/
|
2021-01-07 16:51:35 +01:00
|
|
|
public class ExchangeResponseMappers {
|
2021-01-15 17:53:13 +01:00
|
|
|
/**
|
|
|
|
* @param exchanges lsit of exchanges to be mapped
|
|
|
|
* @return list of api responses
|
|
|
|
*/
|
2021-01-07 16:51:35 +01:00
|
|
|
public static final List<ExchangeResponse> mapToDefaultResponse(List<Exchange> exchanges) {
|
|
|
|
return exchanges.stream().filter(Objects::nonNull).map(ExchangeResponse::new).collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
}
|