Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
testower committed Dec 20, 2024
1 parent 4cda2f6 commit 93ba1b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/main/java/org/entur/lamassu/service/SpatialIndexService.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.entur.lamassu.model.entities.Station;
import org.entur.lamassu.model.entities.Vehicle;
import org.entur.lamassu.model.entities.VehicleType;
import org.entur.lamassu.model.entities.VehicleTypeAvailability;
import org.entur.lamassu.model.provider.FeedProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -59,19 +60,16 @@ public StationSpatialIndexId createStationIndex(
var vehicleTypeIds = station
.getVehicleTypesAvailable()
.stream()
.map(vta -> vta.getVehicleTypeId())
.map(VehicleTypeAvailability::getVehicleTypeId)
.collect(Collectors.toSet());

List<VehicleType> vehicleTypes = vehicleTypeCache.getAll(vehicleTypeIds);

id.setAvailableFormFactors(
vehicleTypes.stream().map(VehicleType::getFormFactor).collect(Collectors.toList())
vehicleTypes.stream().map(VehicleType::getFormFactor).toList()
);
id.setAvailablePropulsionTypes(
vehicleTypes
.stream()
.map(VehicleType::getPropulsionType)
.collect(Collectors.toList())
vehicleTypes.stream().map(VehicleType::getPropulsionType).toList()
);
} else {
id.setAvailableFormFactors(List.of());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public static StationSpatialIndexId createStationIndex(
.getVehicleTypesAvailable()
.stream()
.map(vta -> vta.getVehicleType().getFormFactor())
.collect(Collectors.toList())
.toList()
);
id.setAvailablePropulsionTypes(
station
.getVehicleTypesAvailable()
.stream()
.map(vta -> vta.getVehicleType().getPropulsionType())
.collect(Collectors.toList())
.toList()
);
} else {
id.setAvailableFormFactors(List.of());
Expand Down

0 comments on commit 93ba1b8

Please sign in to comment.