diff --git a/src/main/java/org/entur/lamassu/service/SpatialIndexService.java b/src/main/java/org/entur/lamassu/service/SpatialIndexService.java index 93579106..8aa99c48 100644 --- a/src/main/java/org/entur/lamassu/service/SpatialIndexService.java +++ b/src/main/java/org/entur/lamassu/service/SpatialIndexService.java @@ -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; @@ -59,19 +60,16 @@ public StationSpatialIndexId createStationIndex( var vehicleTypeIds = station .getVehicleTypesAvailable() .stream() - .map(vta -> vta.getVehicleTypeId()) + .map(VehicleTypeAvailability::getVehicleTypeId) .collect(Collectors.toSet()); List 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()); diff --git a/src/test/java/org/entur/lamassu/util/TestSpatialIndexBuilder.java b/src/test/java/org/entur/lamassu/util/TestSpatialIndexBuilder.java index 18ce6d56..e79a07bb 100644 --- a/src/test/java/org/entur/lamassu/util/TestSpatialIndexBuilder.java +++ b/src/test/java/org/entur/lamassu/util/TestSpatialIndexBuilder.java @@ -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());