diff --git a/pom.xml b/pom.xml
index 086376f..65035b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.5
+ 3.2.0
pl.piomin.samples
diff --git a/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/DepartmentRepository.java b/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/DepartmentRepository.java
index a3b8c38..27dbcd8 100644
--- a/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/DepartmentRepository.java
+++ b/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/DepartmentRepository.java
@@ -24,15 +24,14 @@ public List findAll() {
return streamer.stream(Department.class)
.sorted(Department$.name)
.map(DepartmentDTO::new)
- .collect(Collectors.toList());
+ .toList();
}
public long getNumberOfEmployees(Integer id) {
return streamer.stream(Department.class)
.filter(Department$.id.equal(id))
.map(Department::getEmployees)
- .mapToLong(Set::size)
- .sum();
+ .count();
}
public List getEmployees(Integer id) {
@@ -41,7 +40,7 @@ public List getEmployees(Integer id) {
.map(Department::getEmployees)
.flatMap(Set::stream)
.map(EmployeeDTO::new)
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/EmployeeRepository.java b/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/EmployeeRepository.java
index 4f05181..fef9c31 100644
--- a/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/EmployeeRepository.java
+++ b/src/main/java/pl/piomin/samples/spring/jpastreamer/repository/EmployeeRepository.java
@@ -26,7 +26,7 @@ public List findBySalaryGreaterThan(final int salary) {
.filter(Employee$.salary.greaterThan(salary))
.sorted(Employee$.salary)
.map(EmployeeDTO::new)
- .collect(Collectors.toList());
+ .toList();
}
public List findAllWithPagination(final int offset,
@@ -35,7 +35,7 @@ public List findAllWithPagination(final int offset,
.skip(offset)
.limit(limit)
.map(EmployeeDTO::new)
- .collect(Collectors.toList());
+ .toList();
}
public EmployeeWithDetailsDTO findById(final Integer id) {