How to convert nested for loop into Hashmap using java stream
问题 I am trying to convert the below nested for loop into hashmap using java stream but i got struck in the collector step. Could you please help? Existing code: private static HashMap<String, Long> getOutput(List<Employee> eList) { HashMap<String, Long> outputList = new HashMap<>(); for (Employee employee : eList) { List<Department> departmentList = employee.getDepartmentList(); for (Department department : departmentList) { if (department.getType().equals(DepartmentType.SCIENCE)) { outputList