title: Creating maps in Groovy with functions
body: <p>I am trying to understand if the following Groovy syntax is correct:</p>
  
  <pre><code>String f() { return "Hello"}
  String g() { return "World"} 
  
  Map myMap = [
    a : f(),
    b : g(),
  ]
  
  String x = myMap['a']
  String y = myMap['b']
  
  assert x == "Hello"
  assert y == "World"
  </code></pre>
  
  <p>The Groovy language reference documentation on maps is not clear in this regard:</p>
  
  <p><a href="http://docs.groovy-lang.org/latest/html/documentation/index.html#_maps" rel="nofollow">http://docs.groovy-lang.org/latest/html/documentation/index.html#_maps</a></p>