Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Map<String, List<Attendance>> collectAttendancesByUsers(List<Attendance> attendances) {
- //comparing with login - because Employee class does not have own equals/hashcode
- Map<String, List<Attendance>> employeeMap = new HashMap<>();
- for (Attendance att : attendances) {
- String login = att.getEmployee().getLogin();
- List<Attendance> employeeAttendances = employeeMap.get(login);
- if (employeeAttendances == null) {
- employeeAttendances = new ArrayList<>();
- employeeMap.put(login, employeeAttendances);
- }
- employeeAttendances.add(att);
- }
- return employeeMap;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement