Answer the question
In order to leave comments, you need to log in
In a task using the Stream API, you need to find the employee with the highest salary among those who came in 2017?
Good afternoon!
The task contains a text (txt) list of employees, in the format (Last Name, First Name, salary in numbers (78000) and the date this employee started work in the format (11/11/2018)).
There is a class employees "Employee" in this class the lines are written:
private String name;//name
private Integer salary;//salary
private Date workStart;//start work
as well as getters and setters for these parameters.
The list of employees is entered into an ArrayList:
ArrayList staff = loadStaffFromFile();
From this list, you need to find the employee with the highest salary among those who came in 2017? Using the Stream API in one line. I don't know how to filter employees by 2017? Tell me please.
Here is the beginning of my Stream:
staff.stream().sorted(Comparator.comparing(Employee::getWorkStart)).filter(Вот тут должен быть фильтр поиска по 2017 году. Как это реализовать?).forEach(System.out::println);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question