Let’s say I want to prepare a Map from a List of Strings, I use below code to achieve, Expected result: Actual result: Solution To fix the problem, we need to pass merge function along with KeyMapper and ValueMapper, And here is the expected and actual result,