feature: added code refactoring changes for 2378 (#2379)

* fix:added code refactoring changes for 2378

* fix:added code refactoring changes for 2378

* build fix for 2378

* fix: updated pom.xml files for 2378 issue

* fix:build fix for 2378 issue

Co-authored-by: aparna <aparna@aparnas-MacBook-Air.local>
This commit is contained in:
Aparna
2022-12-10 20:25:37 +05:30
committed by GitHub
parent 6693527485
commit 147e2e681a
32 changed files with 202 additions and 134 deletions
@@ -56,7 +56,7 @@ public class FunctionalProgramming {
public static List<String> getModelsAfter2000(List<Car> cars) {
return cars.stream().filter(car -> car.getYear() > 2000)
.sorted(Comparator.comparing(Car::getYear))
.map(Car::getModel).collect(Collectors.toList());
.map(Car::getModel).toList();
}
/**
@@ -78,6 +78,6 @@ public class FunctionalProgramming {
public static List<Car> getSedanCarsOwnedSortedByDate(List<Person> persons) {
return persons.stream().map(Person::getCars).flatMap(List::stream)
.filter(car -> Category.SEDAN.equals(car.getCategory()))
.sorted(Comparator.comparing(Car::getYear)).collect(Collectors.toList());
.sorted(Comparator.comparing(Car::getYear)).toList();
}
}