edit AdviceTranslationServiceImpl
@@ -5,8 +5,8 @@ import greencity.entity.Advice;
import greencity.entity.localization.AdviceTranslation;
import greencity.repository.AdviceTranslationRepo;
import greencity.service.AdviceTranslationService;
+import java.util.Collections;
import java.util.List;
-import java.util.stream.Collectors;
import org.modelmapper.ModelMapper;
import org.modelmapper.TypeToken;
import org.springframework.beans.factory.annotation.Autowired;
@@ -61,10 +61,12 @@ public class AdviceTranslationServiceImpl implements AdviceTranslationService {
List<AdviceTranslation> adviceTranslations = modelMapper.map(advicePostDTO.getTranslations(),
new TypeToken<List<AdviceTranslation>>() {
}.getType());
- adviceTranslations = adviceTranslations
- .stream()
- .peek(a -> a.setAdvice(advice))
- .collect(Collectors.toList());
- return saveAdviceTranslation(adviceTranslations);
+
+ List<AdviceTranslation> adviceTranslationsList = Collections.emptyList();
+ for (AdviceTranslation adviceTranslation : adviceTranslations) {
+ adviceTranslation.setAdvice(advice);
+ adviceTranslationsList.add(adviceTranslation);
+ }
+ return saveAdviceTranslation(adviceTranslationsList);
}
}
