Hej, czy da się z takich dwóch funkcji zrobić jedną działającą w zależności od getera (albo jego nazwy) podanego jako parametr?
private List<Long> mapIds(List<Car> cars) {
return cars.stream()
.map(Car::getId)
.toList();
}
private List<Long> mapOwnerIds(List<Car> cars) {
return cars.stream()
.map(Car::getOwnerId)
.toList();
}