Я маю Listв Employeeс з різними датами приєднання. Я хочу отримати працівників до і після конкретної дати приєднання зі Списку за допомогою потоків.
я спробував наступний код,
List<Employee> employeeListAfter = employeeList.stream()
.filter(e -> e.joiningDate.isAfter(specificDate))
.collect(Collectors.toList());
List<Employee> employeeListBefore = employeeList.stream()
.filter(e -> e.joiningDate.isBefore(specificDate))
.collect(Collectors.toList());
class Employee{
int id;
String name;
LocalDate joiningDate;
}
Чи можливо це зробити в одному потоці?
partitioningBy