diff --git a/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java b/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java index ac55fb856..6277b90a1 100644 --- a/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java +++ b/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java @@ -8,9 +8,7 @@ import org.gridsuite.modification.server.entities.equipment.modification.ReactiveCapabilityCurveModificationEmbeddable; -import java.util.Collections; import java.util.List; -import java.util.Optional; /** * @author jamal kheyyad @@ -20,8 +18,11 @@ private DTOUtils() { } public static List convertToReactiveCapabilityCurveModificationInfos(List rCCpoints) { - return Optional.ofNullable(rCCpoints) - .orElse(Collections.emptyList()).stream().map(value -> value == null + if (rCCpoints == null || rCCpoints.isEmpty()) { + return null; + } + return rCCpoints.stream() + .map(value -> value == null ? new ReactiveCapabilityCurveModificationInfos(null, null, null, null, null, null) : new ReactiveCapabilityCurveModificationInfos( value.getMinQ(), @@ -29,6 +30,7 @@ public static List convertToReactiveCa value.getMaxQ(), value.getOldMaxQ(), value.getP(), - value.getOldP())).toList(); + value.getOldP())) + .toList(); } }