In above code, we used ?keys attribute to get the keySet of HashMap. This key set is iterated and corresponding value is fetched by user.get(key) method.

Note: One thing that’s worth noting here is that the sequence in which the values are printing may be different then the actual sequence in which values are added in hashmap. This is because, hashmap doesn’t preserve order or values. If you want to preserve the sequence of keys use LinkedHashMap.

How do I iterate over a hashmap<String,List> in freemarker? abc() takes as input only strings or arrays. Not lists & the hashmap which I am looking at contains Keys as String & Value as a list of strings.
I want the output to be like :