0 votes
in Programming by (400 points)

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())
    .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.

Please log in or register to answer this question.

...