def map = [:] map["a"] = ["b":1] println map["a"]["b"] println map."a"."b" // Can't assign using dot notation //map."a"."b" = 1 // Cannot set property 'b' on null object map = ["a":["b":["c":1]]] map."a"."b"."c" // Nested lists map = ["a":["b":["c":[1,2,3],"d":[4,5,6] ] ] ] println map."a"."b"."c" println map."a"."b"."d"[2] // Calling index of array // Nested maps map = ["a":["b":["c":["c1":1,"c2":2],"d":["d1":4,"d2":5] ] ] ] println map."a"."b"."c"."c2" println map."a"."b"."d"."d1"
Groovy: Nested Maps Thursday, May 9, 2013
Posted by MichaelQuaMan at 12:52 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment