diff --git a/kgparserSrv/src/main/java/ru/klavogonki/kgparser/Car.java b/kgparserSrv/src/main/java/ru/klavogonki/kgparser/Car.java index 5407dd89..6ddcdd1c 100644 --- a/kgparserSrv/src/main/java/ru/klavogonki/kgparser/Car.java +++ b/kgparserSrv/src/main/java/ru/klavogonki/kgparser/Car.java @@ -141,7 +141,7 @@ public static Car getById(int carId) { List carsWithId = Arrays .stream(Car.values()) .filter(car -> car.id == carId) - .collect(Collectors.toList()); + .toList(); if (carsWithId.size() == 1) { return carsWithId.get(0); @@ -151,7 +151,7 @@ public static Car getById(int carId) { List carsWithPersonalId = Arrays .stream(Car.values()) .filter(car -> (car.personalId != null) && (car.personalId == carId)) - .collect(Collectors.toList()); + .toList(); if (carsWithPersonalId.size() == 1) { return carsWithPersonalId.get(0); diff --git a/kgparserSrv/src/test/java/ru/klavogonki/kgparser/CarTest.java b/kgparserSrv/src/test/java/ru/klavogonki/kgparser/CarTest.java index f65643ce..67f06818 100644 --- a/kgparserSrv/src/test/java/ru/klavogonki/kgparser/CarTest.java +++ b/kgparserSrv/src/test/java/ru/klavogonki/kgparser/CarTest.java @@ -6,7 +6,6 @@ import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -18,11 +17,12 @@ class CarTest { void testCarIdsAreUnique() { Car[] cars = Car.values(); - List uniqueCarIds = Arrays.stream(cars) + List uniqueCarIds = Arrays + .stream(cars) .map(car -> car.id) .distinct() .sorted() - .collect(Collectors.toList()); + .toList(); logger.info("unique car ids: \n{}", uniqueCarIds); @@ -33,11 +33,12 @@ void testCarIdsAreUnique() { void testCarNamesAreUnique() { Car[] cars = Car.values(); - List uniqueCarNames = Arrays.stream(cars) + List uniqueCarNames = Arrays + .stream(cars) .map(car -> car.name) .distinct() .sorted() - .collect(Collectors.toList()); + .toList(); logger.info("unique car names: \n{}", uniqueCarNames); @@ -48,12 +49,13 @@ void testCarNamesAreUnique() { void testAllPersonalCarIdsArePersonalIds() { Car[] cars = Car.values(); - List carPersonalIds = Arrays.stream(cars) + List carPersonalIds = Arrays + .stream(cars) .filter(car -> (car.personalId != null)) .map(car -> car.personalId) .distinct() .sorted() - .collect(Collectors.toList()); + .toList(); logger.info("personal car ids for cars that have been made public: \n{}", carPersonalIds); @@ -66,11 +68,12 @@ void testAllPersonalCarIdsArePersonalIds() { void testAllPersonalCarsThatWereMadePublicHaveOriginalOwnerFilled() { Car[] cars = Car.values(); - List personalCarsThatWereMadePublic = Arrays.stream(cars) + List personalCarsThatWereMadePublic = Arrays + .stream(cars) .filter(Car::wasPersonalButMadePublic) .distinct() .sorted() - .collect(Collectors.toList()); + .toList(); logger.info("cars that were personal but have been made public: \n{}", personalCarsThatWereMadePublic); diff --git a/kgstatsSrv/src/main/java/ru/klavogonki/statistics/import_db/DatabaseImporter.java b/kgstatsSrv/src/main/java/ru/klavogonki/statistics/import_db/DatabaseImporter.java index 8870c154..e9194ebb 100644 --- a/kgstatsSrv/src/main/java/ru/klavogonki/statistics/import_db/DatabaseImporter.java +++ b/kgstatsSrv/src/main/java/ru/klavogonki/statistics/import_db/DatabaseImporter.java @@ -141,7 +141,7 @@ private void savePlayerToDatabase(PlayerEntity player) { .stream() .map(PlayerEntity::getDbId) .sorted() - .collect(Collectors.toList()); + .toList(); if (existingPlayersWithId.isEmpty()) { logger.debug("No players with playerId = {} found in the database. Nothing to delete.", playerId);