How to define an empty map of map in Groovy?

Viewed 25

Groovy newbie here! I know that I can use:

def map = [:] 

To define an empty map. However, how can I define a map of map like Map<String, Map<String, String>>?

I've tried

def map = [[:]]

but doesn't seems to be correct. I can't find a valuable example on google.

For more context, I need to define a map which will contain a structure of data like:

key1 -> <k1,v1>
        <k2,v2>
        ...
key2 -> <k1,v1>
        <k2,v2>
        ...

to be able to access it with:

map[k][v]
0 Answers
Related