I am trying to create a Map from a list, whereas value of Map would be a result of some transformation, this is how my code looks like.
empIdList.stream()
.map(id-> getDepartment(id))
.collect(Collectors.toMap(id, department:String -> department)
in this above example I am looking to use id as key and department as value. can you please help me achieving my expected results.