Skip to content
Snippets Groups Projects
Commit 260b5342 authored by Diana Gulčíková's avatar Diana Gulčíková
Browse files

checkstyle fixes

parent b0d743cf
No related branches found
No related tags found
2 merge requests!60Docker,!40Small fixes on car module
Pipeline #
...@@ -86,11 +86,11 @@ public class CarComponentPairServiceImpl implements CarComponentPairService { ...@@ -86,11 +86,11 @@ public class CarComponentPairServiceImpl implements CarComponentPairService {
private boolean isComponentInUse(Long componentId, Long carId) { private boolean isComponentInUse(Long componentId, Long carId) {
var cars = carRepository.findAll(); var cars = carRepository.findAll();
for (Car car: cars) { for (Car car : cars) {
if (car.getComponents().stream() if (car.getComponents().stream()
.anyMatch(x -> x.longValue() == componentId && !Objects.equals(car.getId(), carId))){ .anyMatch(x -> x.longValue() == componentId && !Objects.equals(car.getId(), carId))) {
return true; return true;
} }
} }
return false; return false;
} }
......
...@@ -36,7 +36,7 @@ public class CarServiceImpl implements CarService { ...@@ -36,7 +36,7 @@ public class CarServiceImpl implements CarService {
public CarResponseDto postCar(CarRequestDto carRequestDto) { public CarResponseDto postCar(CarRequestDto carRequestDto) {
var componentIds = carRequestDto.getComponentIds(); var componentIds = carRequestDto.getComponentIds();
for (Long componentId: componentIds) { for (Long componentId : componentIds) {
if (isComponentInUse(componentId)) { if (isComponentInUse(componentId)) {
throw new DatabaseException("Component with id " + componentId + " already in use"); throw new DatabaseException("Component with id " + componentId + " already in use");
} }
...@@ -72,9 +72,9 @@ public class CarServiceImpl implements CarService { ...@@ -72,9 +72,9 @@ public class CarServiceImpl implements CarService {
private boolean isComponentInUse(Long componentId) { private boolean isComponentInUse(Long componentId) {
var cars = carRepository.findAll(); var cars = carRepository.findAll();
for (Car car: cars) { for (Car car : cars) {
if (car.getComponents().stream() if (car.getComponents().stream()
.anyMatch(x -> x.longValue() == componentId)){ .anyMatch(x -> x.longValue() == componentId)) {
return true; return true;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment