Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: used formatted code snippet instead.

...

In Groovy, maps override the dot operator to behave the same as the index[ ] operator. So myMap.size is the same as calling myMap:

Code Block
myMap["size"]

...

="ONE MILLION!!!";
println myMap.size        // outputs 'ONE MILLION!!!'

//use the following:
println myMap.@size       // '1'
println myMap.size()

...

      // '1'
println myMap.getClass()  // 'class java.util.HashMap'

Why is my map returning null values?

...

Code Block
myMap = [myVar:"one"];
assert myMap["myVar"] == "one"

...