I got array list of strings, how could I reduce them to hash map
Input: [a, b, a, a, c, x]
Output: {(a: 3), (b: 1), (c: 1), (x: 1)}
PS. I searched for this. I need to do that with reduce
not with frequency counting as in other questions, because my question is a simplified real task.